<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>商品管理</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  {include file="public/css"/}
	<style>
		.guigeimg{display: inline-block; position: relative}
		.guigeimg_close{width: 25px;height: 22px;right: -14px;top:-14px;}
		#ggnamediv .layui-input,#ggvaldiv .layui-input{ display:inline;height:30px}
		.panel-body .dsn-panel-editor .ng-scope .layui-form-label{width: 100px;}
	</style>
</head>
<body>
  <div class="layui-fluid">
    <div class="layui-row layui-col-space15">
      <div class="layui-card layui-col-md12">
				<div class="layui-card-header">
					{if !$info['id']}<i class="fa fa-plus"></i> 添加商品{else}<i class="fa fa-pencil"></i> 编辑商品{/if}
					<i class="layui-icon layui-icon-close" style="font-size:18px;font-weight:bold;cursor:pointer" onclick="closeself()"></i>
				</div>
				<div class="layui-card-body" pad15>
					{if $info['ischecked']==2}<blockquote class="layui-elem-quote" style="color:red">商品未审核通过，驳回原因：{$info.check_reason}</blockquote>{/if}
					<div class="layui-form form-label-w8">
						<div class="layui-tab" lay-filter="mytab">
							<ul class="layui-tab-title">
								<li class="layui-this" lay-id="1">商品基本信息</li>
								<li lay-id="2">商品详情</li>
							</ul>
							<div class="layui-tab-content">
								<div class="layui-tab-item layui-show">
									<input type="hidden" name="id" value="{$info['id']}"/>
									<div class="layui-form-item">
										<label class="layui-form-label"><span class="redstar">*</span>商品名称：</label>
										<div class="layui-input-inline" style="width:300px">
											<input type="text" name="info[name]" lay-verify="required" lay-verType="tips" class="layui-input" value="{$info['name']}">
										</div>
										<button type="button" class="layui-btn layui-btn-primary" onclick="showChooseProduct()">选择商城商品</button>
									</div>
									<div class="layui-form-item">
										<label class="layui-form-label">商品主图：</label>
										<button style="float:left;" type="button" class="layui-btn layui-btn-primary" upload-input="pic" upload-preview="picPreview" onclick="uploader(this)">上传图片</button>
										<div class="layui-form-mid layui-word-aux" style="margin-left:10px;">建议尺寸：640×640像素</div>
										<div id="picPreview" class="picsList-class-padding">
											<div class="layui-imgbox imgbox-required">
												<div class="layui-imgbox-img"><img src="{$info['pic']}"/></div>
												<input type="text" name="info[pic]" id="pic" class="layui-input" value="{$info['pic']}">
											</div>
										</div>
									</div>
									<div class="layui-form-item">
										<label class="layui-form-label">商品图片：</label>
										<input type="hidden" name="info[pics]" value="{$info['pics']}" id="pics">
										<button style="float:left;" type="button" class="layui-btn layui-btn-primary" onclick="uploader(this,true)" upload-input="pics" upload-preview="picList" >批量上传</button>
										<div class="layui-form-mid layui-word-aux" style="margin-left:10px;">建议尺寸：640×640像素</div>
										<div id="picList" class="picsList-class-padding">
											{if $info['pics']}
											{php}$pics = explode(',',$info['pics']);{/php}
											{foreach $pics as $pic}
											<div class="layui-imgbox">
												<a class="layui-imgbox-close" href="javascript:void(0)" onclick="$(this).parent().remove();getpicsval('pics','picList')" title="删除"><i class="layui-icon layui-icon-close-fill-opaque"></i></a>
												<span class="layui-imgbox-img"><img src="{$pic}"></span>
											</div>
											{/foreach}{/if}
										</div>
									</div>
									<!-- <div class="layui-form-item">
										<label class="layui-form-label">商品服务：</label>
										<div class="layui-input-inline" style="width:400px">
											<input type="text" name="info[fuwupoint]" class="layui-input" value="{$info['fuwupoint']}">
										</div>
										<div class="layui-form-mid layui-word-aux">多个用空格隔开,如: 7天退换 48小时发货 假一赔十</div>
									</div>
									<div class="layui-form-item">
										<label class="layui-form-label">商品卖点：</label>
										<div class="layui-input-inline" style="width:400px">
											<input type="text" name="info[sellpoint]" class="layui-input" value="{$info['sellpoint']}">
										</div>
										<div class="layui-form-mid layui-word-aux">在商品详情页标题下面展示卖点信息，建议60字以内</div>
									</div>
									<div class="layui-form-item">
										<label class="layui-form-label">商品编码：</label>
										<div class="layui-input-inline">
											<input type="text" name="info[procode]" class="layui-input" value="{$info['procode']}">
										</div>
									</div> -->
									<div class="layui-form-item">
										<label class="layui-form-label">商品分类：</label>
										<div class="layui-input-inline">
											<select name="info[cid]">
											<option value="">--请选择--</option>
											{foreach $clist as $cv}
												<option value="{$cv['id']}" {if $cv['id']==$info['cid']}selected{/if}>{$cv['name']}</option>
												{foreach $cv['child'] as $v}
												<option value="{$v['id']}" {if $v['id']==$info['cid']}selected{/if}>&nbsp;&nbsp;&nbsp;{$v['name']}</option>
												{/foreach}
											{/foreach}
											</select>
										</div>
										<!-- <div class="layui-form-mid layui-word-aux"><a href="categoryadd.php">创建分类</a></div> -->
									</div>
									{if getcustom('luckycollage_score_pay') && $bid == 0}
									<div class="layui-form-item">
										<label class="layui-form-label">支付类型：</label>
										<div class="layui-input-inline">
											<input type="radio" name="info[pay_type]"   value="0" title="金额" {if !$info['id'] || $info['pay_type']==0}checked{/if}/>
											<input type="radio" name="info[pay_type]"   value="1" title="{:t('积分')}" {if $info['id'] && $info['pay_type']==1}checked{/if}/>
										</div>
										<div class="layui-form-mid layui-word-aux">
										*金额支付指现金支付，余额、微信、支付宝 &nbsp;
										*积分是用积分支付，开启积分支付时，发放金额奖励填写具体金额，不要使用按比例发放。按比例会用积分支付的比例发放</div>
									</div>
									{/if}
									<div class="layui-form-item" id="setgg">
										<label class="layui-form-label">设置规格：</label>
										<div class="layui-input-inline" style="width:auto">
											<table id="ggnamediv"  class="layui-table" style="width:600px">
												<thead>
												<tr>
													<th>规格分组</th>
													<th>规格名称</th>
													<th>操作</th>
												</tr>
												</thead>
												{php}$guigedata = json_decode($info['guigedata']);{/php}
												{if $guigedata}
												{foreach $guigedata as $k=>$gg}
												<tr>
													<td><input type="text" class="layui-input" name="ggname" value="{$gg->title}" style="width:120px"/></td>
													<td>
														{foreach $gg->items as $k2=>$ggitem}
														<div><input type="text" class="layui-input"style="width:180px" value="{$ggitem->title}" placeholder="请输入规格名称">
														{if $k2==0}
															<button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="addggname(this)" style="margin-top:-3px;"><i class="fa fa-plus" style="font-size:14px!important"></i></button>
														{else}
															<button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="$(this).parent().remove()" style="margin-top:-3px;"><i class="fa fa-remove" style="font-size:14px!important"></i></button>
														{/if}
														</div>
														{/foreach}
													</td>
													{if $k==0}
													<td><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="addggtype()">添加</button></td>
													{else}
													<td><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="$(this).parent().parent().remove()">删除</button></td>
													{/if}
												</tr>
												{/foreach}
												{else}
												<tr>
													<td><input type="text" class="layui-input" name="ggname" value="规格" style="width:120px"/></td>
													<td><div><input type="text" class="layui-input" style="width:180px" value="默认规格" placeholder="请输入规格名称"> <button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="addggname(this)" style="margin-top:-3px;"><i class="fa fa-plus" style="font-size:14px!important"></i></button></div></td>
													<td><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="addggtype()">添加</button></td>
												</tr>
												{/if}
											</table>
											<button type="button"  class="layui-btn layui-btn-sm layui-btn-primary" onclick="refreshgg({ })"><i class="fa fa-refresh" style="font-size:14px!important"></i>设置完成</button>
											<table id="ggvaldiv" class="layui-table" style="margin-top:20px;">
											</table>
											<input type="hidden" name="specs" value=""/>
										</div>
									</div>
									<div class="layui-form-item">
										<label class="layui-form-label">配送模板：</label>
										<div class="layui-input-inline" style="width:500px">
											<input type="radio" name="info[freighttype]" value="1" title="全部模板" {if !$info['id'] || $info['freighttype']==1}checked{/if} lay-filter="freighttypeset"/>
											<input type="radio" name="info[freighttype]" value="0" title="选择模板" {if $info['id'] && $info['freighttype']==0}checked{/if} lay-filter="freighttypeset"/>
											<input type="radio" name="info[freighttype]" value="3" title="自动发货" {if $info['id'] && $info['freighttype']==3}checked{/if} lay-filter="freighttypeset"/>
											<input type="radio" name="info[freighttype]" value="4" title="在线卡密" {if $info['id'] && $info['freighttype']==4}checked{/if} lay-filter="freighttypeset"/>
										</div>

										<div id="freighttype3_4" style="{if ($info['freighttype']!=3 && $info['freighttype']!=4)}display:none{/if}">
											<div class="layui-form-item">
												<label class="layui-form-label"></label>
												<div class="layui-form-mid">
													<input type="checkbox" name="info[contact_require]" title="必填联系人、手机号信息" value="1" {if $info['contact_require']==1}checked{/if}>
												</div>
											</div>
										</div>

										<div id="freighttype3" style="{if $info['freighttype']!=3}display:none{/if}">
											<div class="layui-form-item">
												<label class="layui-form-label"></label>
												<div class="layui-input-inline" style="width:500px">
													<textarea type="text" name="info[freightcontent]" placeholder="请输入发货信息" class="layui-textarea">{$info.freightcontent}</textarea>
												</div>
											</div>
										</div>
										<div id="freighttype4" style="{if $info['freighttype']!=4}display:none{/if}">
											<div class="layui-form-item">
												<label class="layui-form-label"></label>
												<div class="layui-form-mid">请保存商品信息后在商品列表中上传卡密信息；用户购买几件将发送几个卡密信息</div>
											</div>
										</div>

										<div id="setfreight" style="clear:both;{if !$info['id'] || $info['freighttype']!=0}display:none{/if}">
											<label class="layui-form-label"></label>
											<div class="layui-input-inline" style="width:auto">
												<table id="setfreightdiv"  class="layui-table" style="width:500px">
													<thead>
													<tr>
														<th>模板ID</th>
														<th>模板名称</th>
														<th>操作</th>
													</tr>
													</thead>
													
													{if $freightdata}
													{foreach $freightdata as $k=>$ff}
													<tr class="freightlisttr"><td>{$ff.id}</td><td>{$ff.name}</td><td><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="delfreight(this,{$ff.id})">删除</button></td></tr>
													{/foreach}
													{/if}
													<tr id="freightaddtr">
														<td colspan="3"><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="showChooseFreight()">添加</button></td>
													</tr>
												</table>
												<input type="hidden" name="info[freightdata]" value="{$info.freightdata}"/>
											</div>
										</div>
									</div>
									<script>
									var chooseFreightLayer;
									function showChooseFreight(){
										chooseFreightLayer = layer.open({type:2,title:'选择配送模板',content:"{:url('Freight/choosefreight')}",area:['1000px','600px'],shadeClose:true});
									}
									function chooseFreight(fid,fname){
										layer.close(chooseFreightLayer);
										var freightlistids = [];
										var isadd = 0;
										$('.freightlisttr').each(function(){
											var thisfid = $(this).find('td:eq(0)').html();
											if(thisfid == fid){
												isadd = 1
												dialog('该配送模板已添加过了');
											}
											freightlistids.push(thisfid)
										})
										if(isadd == 0){
											freightlistids.push(fid)
											$("input[name='info[freightdata]']").val(freightlistids.join(','));
											$('#freightaddtr').before('<tr class="freightlisttr"><td>'+fid+'</td><td>'+fname+'</td><td><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="delfreight(this,'+fid+')">删除</button></td></tr>');
										}
										console.log(freightlistids)
									}
									function delfreight(obj,fid){
										$(obj).parent().parent().remove();
										var freightlistids = [];
										$('.freightlisttr').each(function(){
											freightlistids.push($(this).find('td:eq(0)').html())
										})
										$("input[name='info[freightdata]']").val(freightlistids.join(','));
									}
									</script>
									{if getcustom('business_show_platform_product') && $bid == 0}
									<div class="layui-form-item">
										<label class="layui-form-label">允许商户显示：</label>
										<div class="layui-input-inline">
											<input type="radio" name="info[business_show]" value="0" title="关闭" {if !$info['business_show'] || $info['business_show']==0}checked{/if}/>
											<input type="radio" name="info[business_show]" value="1" title="开启" {if $info['business_show'] && $info['business_show']==1}checked{/if}/>
										</div>
										<div class="layui-form-mid layui-word-aux">设计界面 商品来源选择[主商城授权产品]显示</div>
									</div>
									{/if}
									{if getcustom('business_hexiaoplatform_ticheng') && $bid == 0}
									<div class="layui-form-item">
										<label class="layui-form-label">商户核销提成：</label>
										<div class="layui-input-inline">
											<input type="text" name="info[business_hx_ticheng]" value="{$info['business_hx_ticheng']}" class="layui-input">
										</div>
										<div class="layui-form-mid">%</div>
										<div class="layui-form-mid layui-word-aux">按照售价比例发放，发放到商户余额中</div>
									</div>
									{/if}
									<div class="layui-form-item">
										<label class="layui-form-label">拼团人数：</label>
										<div class="layui-input-inline">
											<input type="text" name="info[teamnum]" value="{$info['id']?$info['teamnum']:'3'}" {if $teamnumCanedit==false}readonly{/if} class="layui-input">
										</div>
										<div class="layui-form-mid layui-word-aux">每个团多少人</div>
									</div>
									<div class="layui-form-item">
										<label class="layui-form-label">中奖人数：</label>
										<div class="layui-input-inline">
											<input type="text" name="info[gua_num]" value="{$info['id']?$info['gua_num']:'1'}" class="layui-input">
										</div>
										<div class="layui-form-mid layui-word-aux">*中奖人数必须大于等于1，并且小于拼团人数</div>
									</div>

									{if getcustom('plug_luckycollage')}
									<div class="layui-form-item">
										<label class="layui-form-label">不中奖励：</label>
										<div class="layui-input-inline" style="width:420px">
											<input type="radio" name="info[bzjl_type]"  lay-filter="bzjl_type" value="1" title="2{:t('余额')}" {if !$info['id'] || $info['bzjl_type']==1}checked{/if}/>
											{if $bid == 0}<input type="radio" name="info[bzjl_type]"  lay-filter="bzjl_type" value="2" title="3{:t('积分')}" {if $info['id'] && $info['bzjl_type']==2}checked{/if}/>{/if}
											<input type="radio" name="info[bzjl_type]"  lay-filter="bzjl_type" value="3" title="{:t('佣金')}" {if $info['id'] && $info['bzjl_type']==3}checked{/if}/>
											<input type="radio" name="info[bzjl_type]"  lay-filter="bzjl_type" value="4" title="{:t('优惠券')}" {if $info['id'] && $info['bzjl_type']==4}checked{/if}/>
										</div>
									</div>
									<div class="layui-form-item" id="bzj_money" {if $info && $info['bzjl_type']!=1}style="display:none"{/if}>
										<label class="layui-form-label">不中奖励{:t('余额')}：</label>
										<div class="layui-input-inline">
											<input type="text" name="info[fy_money_val]" value="{$info['id']?$info['fy_money_val']:'0'}" class="layui-input">
										</div>
										<div class="layui-form-mid layui-word-aux">赠送不中奖会员多少{:t('余额')}</div>
									</div>
									{if $bid == 0}
									<div class="layui-form-item" id="bzjscore" {if $info['bzjl_type']!=2}style="display:none"{/if}>
										<label class="layui-form-label">不中奖励{:t('积分')}：</label>
										<div class="layui-input-inline">
											<input type="text" name="info[bzj_score]" value="{$info['id']?$info['bzj_score']:'0'}" class="layui-input">
										</div>
										<div class="layui-form-mid layui-word-aux">赠送不中奖会员多少{:t('积分')}</div>
									</div>
									{/if}
									<div class="layui-form-item" id="bzjcommission" {if $info['bzjl_type']!=3}style="display:none"{/if}>
										<label class="layui-form-label">不中奖励{:t('佣金')}：</label>
										<div class="layui-input-inline">
											<input type="text" name="info[bzj_commission]" value="{$info['id']?$info['bzj_commission']:'0'}" class="layui-input">
										</div>
										<div class="layui-form-mid layui-word-aux">赠送不中奖会员多少{:t('佣金')}</div>
									</div>
									<div class="layui-form-item" id="bzjyhq" {if $info['bzjl_type']!=4}style="display:none"{/if}>
										<label class="layui-form-label">不中奖励{:t('优惠券')}：</label>
										<div class="layui-input-inline">
											<input type="text" name="info[bzj_yhqids]" value="{$info[bzj_yhqids]}" class="layui-input">
										
										</div>
										<div class="layui-form-mid layui-word-aux">请填写{:t('优惠券')}id,多个请用逗号隔开如：112,110,请确认{:t('优惠券')}的有效期、库存有效</div>
									</div>
									{/if}<!--plug_luckycollage end-->

									{if !getcustom('plug_luckycollage')}<!--默认设置项-->
									<div class="layui-form-item">
										<label class="layui-form-label">不中奖励红包：</label>
										<div class="layui-input-inline">
											<input type="radio" name="info[fy_type]"  lay-filter="fy_type" value="1" title="按比例" {if !$info['id'] || $info['fy_type']==1}checked{/if}/>
											<input type="radio" name="info[fy_type]"  lay-filter="fy_type" value="2" title="按金额" {if $info['id'] && $info['fy_type']==2}checked{/if}/>
										</div>
										<div class="layui-form-mid layui-word-aux">
										*按比例指该商品最低金额比例 &nbsp;
										*按金额指不中用户每人都获得该金额红包</div>
									</div>
									
									<div class="layui-form-item"  id="fy_type1" {if $info && $info['fy_type']!=1}style="display:none"{/if}>
										<label class="layui-form-label">红包比例：</label>
										<div class="layui-input-inline">
											<input type="text" name="info[fy_money]" value="{$info['id']?$info['fy_money']:'1'}" class="layui-input">
										</div>
										<div class="layui-form-mid layui-word-aux">%</div>
									</div>
									<div class="layui-form-item" id="fy_type2" {if  $info['fy_type']!=2}style="display:none"{/if}>
										<label class="layui-form-label">红包金额：</label>
										<div class="layui-input-inline">
											<input type="text" name="info[fy_money_val]" value="{$info['id']?$info['fy_money_val']:'1'}" class="layui-input">
										</div>
										<div class="layui-form-mid layui-word-aux"></div>
									</div>
									<div class="layui-form-item">
										<label class="layui-form-label">返红包模式：</label>
										<div class="layui-input-inline" style="width:auto">
											<input type="radio" name="info[red_give_mode]" value="1" title="返到余额" {if !$info['id'] || $info['red_give_mode']==1}checked{/if}/>
											<input type="radio" name="info[red_give_mode]" value="2" title="返到微信零钱" {if $info['id'] && $info['red_give_mode']==2}checked{/if}/>
											{if getcustom('luckycollage_red_give_commission')}
											<input type="radio" name="info[red_give_mode]" value="3" title="返到{:t('佣金')}" {if $info['id'] && $info['red_give_mode']==3}checked{/if}/>
											{/if}
										</div>
										<div class="layui-form-mid layui-word-aux" style="">
										*返到微信零钱模式，需要去微信支付开通“企业付款到零钱”功能；且需设置最低金额，微信商户号企业到零钱功能一般最低提现金额是一元，如有特殊情况自行设定金额；
										</div>
									</div>
									{/if}

									{if getcustom('luckycollage_bzjl')}
									<div class="layui-form-item">
										<label class="layui-form-label">不中奖励：</label>
										<div class="layui-input-inline" style="width:420px">
											{if $bid ==0}<input type="radio" name="info[bzjl_type]"  lay-filter="bzjl_type" value="2" title="{:t('积分')}" {if $info['id'] && $info['bzjl_type']==2}checked{/if}/>{/if}
											<input type="radio" name="info[bzjl_type]"  lay-filter="bzjl_type" value="3" title="{:t('佣金')}" {if $info['id'] && $info['bzjl_type']==3}checked{/if}/>
											<input type="radio" name="info[bzjl_type]"  lay-filter="bzjl_type" value="4" title="{:t('优惠券')}" {if $info['id'] && $info['bzjl_type']==4}checked{/if}/>
										</div>
									</div>
									{if $bid ==0}
									<div class="layui-form-item bzjlscore_type" id="bzjlscore_type"  {if $info['bzjl_type']!=2}style="display:none"{/if}>
										<label class="layui-form-label">不中积分类型：</label>
										<div class="layui-input-inline">
											<input type="radio" name="info[bzjlscore_type]"  lay-filter="bzjlscore_type" value="1" title="按比例" {if !$info['id'] || !$info['bzjl_type'] ||  ($info['id'] && $info['bzjlscore_type']==1)}checked{/if}/>
											<input type="radio" name="info[bzjlscore_type]"  lay-filter="bzjlscore_type" value="2" title="按个数" {if $info['id']  &&$info['bzjlscore_type']==2}checked{/if}/>
										</div>
										<div class="layui-form-mid layui-word-aux">
										*按比例指该商品最低金额比例{:t('积分')} &nbsp;
										按个数指不中用户每人都获得该积{:t('积分')}个数</div>
									</div>
									<div class="layui-form-item bzjlscore_type"  id="bzjlscore_type1" {if $info['bzjlscore_type']!=1}style="display:none"{/if}>
										<label class="layui-form-label">不中积分比例：</label>
										<div class="layui-input-inline">
											<input type="text" name="info[bzjlscore_rate]" value="{$info['id']?$info['bzjlscore_rate']:'0'}" class="layui-input">
										</div>
										<div class="layui-form-mid layui-word-aux">% 拼团成功后赠送不中奖者{:t('积分')}百分比 该商品最低金额的百分比</div>
									</div>
									<div class="layui-form-item bzjlscore_type" id="bzjscore" {if $info['bzjlscore_type']!=2}style="display:none"{/if}>
										<label class="layui-form-label">不中奖励{:t('积分')}：</label>
										<div class="layui-input-inline">
											<input type="text" name="info[bzj_score]" value="{$info['id']?$info['bzj_score']:'0'}" class="layui-input">
										</div>
										<div class="layui-form-mid layui-word-aux">拼团成功后赠送不中奖者多少{:t('积分')}</div>
									</div>
	  								{/if}
									<div class="layui-form-item" id="bzjcommission" {if $info['bzjl_type']!=3}style="display:none"{/if}>
										<label class="layui-form-label">不中奖励{:t('佣金')}：</label>
										<div class="layui-input-inline">
											<input type="text" name="info[bzj_commission]" value="{$info['id']?$info['bzj_commission']:'0'}" class="layui-input">
										</div>
										<div class="layui-form-mid layui-word-aux">拼团成功后赠送不中奖奖者多少{:t('佣金')}</div>
									</div>
									<div class="layui-form-item" id="bzjyhq" {if $info['bzjl_type']!=4}style="display:none"{/if}>
										<label class="layui-form-label">不中奖励{:t('优惠券')}：</label>
										<div class="layui-input-inline">
											<input type="text" name="info[bzj_yhqids]" value="{$info[bzj_yhqids]}" class="layui-input">
										</div>
										<div class="layui-form-mid layui-word-aux">请填写{:t('优惠券')}id,多个请用逗号隔开如：112,110,请确认{:t('优惠券')}的有效期、库存有效</div>
									</div>
									{/if}<!--luckycollage_bzjl end-->

									<div class="layui-form-item">
										<label class="layui-form-label">不中奖退款路线：</label>
										<div class="layui-input-inline" style="width:auto">
											<input type="radio" name="info[tklx]" value="1" title="原路退回" {if !$info['id'] || $info['tklx']==1}checked{/if}/>
											<input type="radio" name="info[tklx]" value="2" title="退款到余额" {if $info['id'] && $info['tklx']==2}checked{/if}/>
											{if getcustom('luckycollage_norefund')}
											<input type="radio" name="info[tklx]" value="3" title="不退款" {if $info['id'] && $info['tklx']==3}checked{/if}/>
											{/if}
										</div>
										<div class="layui-form-mid layui-word-aux" style="">
										*默认原路退回
										</div>
									</div>
									<div class="layui-form-item">
										<label class="layui-form-label">拼团失败退款路线：</label>
										<div class="layui-input-inline" style="width:auto">
											<input type="radio" name="info[failtklx]" value="1" title="原路退回" {if !$info['id'] || $info['failtklx']==1}checked{/if}/>
											<input type="radio" name="info[failtklx]" value="2" title="退款到余额" {if $info['id'] && $info['failtklx']==2}checked{/if}/>
										</div>
										<div class="layui-form-mid layui-word-aux" style="">
										*默认原路退回
										</div>
									</div>
									<div class="layui-form-item">
										<label class="layui-form-label">每人限购：</label>
										<div class="layui-input-inline">
											<input type="text" name="info[buymax]" value="{$info['id']?$info['buymax']:'0'}" class="layui-input">
										</div>
										<div class="layui-form-mid layui-word-aux">每人最多可购买多少件，0表示不限购</div>
									</div>
									{if getcustom('luckycollage_zjmax')}
									<div class="layui-form-item">
										<label class="layui-form-label">可拼中的最高次数：</label>
										<div class="layui-input-inline">
											<input type="text" name="info[zjmax]" value="{$info['id']?$info['zjmax']:'0'}" class="layui-input">
										</div>
										<div class="layui-form-mid layui-word-aux">每个会员参团可拼中的最高次数, 0表示不限制</div>
									</div>
									{/if}
									<div class="layui-form-item">
										<label class="layui-form-label">每单限购：</label>
										<div class="layui-input-inline">
											<input type="text" name="info[perlimitdan]" value="{$info['id']?$info['perlimitdan']:'0'}" class="layui-input">
										</div>
										<div class="layui-form-mid layui-word-aux">每单最多可购买多少件，0表示不限购</div>
									</div>
  									{if getcustom('luckycollage_everyday_limit')}
									<div class="layui-form-item">
									  <label class="layui-form-label">每日限购单数：</label>
									  <div class="layui-input-inline">
										  <input type="text" name="info[everyday_ordercount_limit]" value="{$info['id']?$info['everyday_ordercount_limit']:'0'}" class="layui-input">
									  </div>
									  <div class="layui-form-mid layui-word-aux">每人每日最多可购买多少单，0表示不限购</div>
									</div>
  									{/if}

									<div class="layui-form-item">
										<label class="layui-form-label">拼团时间：</label>
										<div class="layui-input-inline">
											<input type="text" name="info[teamhour]" value="{$info['id']?$info['teamhour']:'36'}" class="layui-input">
										</div>
										<div class="layui-form-mid">小时</div>
										<div class="layui-form-mid layui-word-aux">超过该时间人数未满则拼团失败，自动退款</div>
									</div>
									<div class="layui-form-item">
										<label class="layui-form-label">团长优惠金额：</label>
										<div class="layui-input-inline">
											<input type="text" name="info[leadermoney]" value="{$info['id']?$info['leadermoney']:'0'}" class="layui-input">
										</div>
										<div class="layui-form-mid">元</div>
										<div class="layui-form-mid layui-word-aux">在拼团价基础上再优惠多少钱，0表示不优惠</div>
									</div>
				
									{if getcustom('plug_luckycollage')}	
									<div class="layui-form-item">
										<label class="layui-form-label">开团限制：</label>
										{if !$levellist}
										<div class="layui-form-mid" style="color:red">未设置{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置会员等级</div>
										{else}
											{php}
											$ktxz = json_decode($info['ktxianzhi'],true);
											if(!$ktxz) $ktxz = [];
											{/php}
											{foreach $levellist as $l}
											<div class="layui-form-item">
												<label class="layui-form-label">{$l['name']}：</label>
												<div class="layui-input-inline layui-module-itemL">
													<div>最少中奖</div>
													<input type="text" name="ktxianzhi[{$l.id}][minzjnum]" class="layui-input" value="{$ktxz[$l['id']]['minzjnum']}">
													次 才可开团
												</div>
												<div class="layui-input-inline layui-module-itemL">
													<div>最多开团次数</div>
													<input type="text" name="ktxianzhi[{$l.id}][maxktnum]" class="layui-input" value="{$ktxz[$l['id']]['maxktnum']}">
													次
												</div>
											</div>
											{/foreach}
										{/if}
										<div class="layui-form-mid layui-word-aux"></div>
									</div>

									<div class="layui-form-item">
										<label class="layui-form-label">团长奖励：</label>
										<div class="layui-input-inline" style="width:420px">
											<input type="radio" name="info[tzjl_type]"  lay-filter="tzjl_type" value="1" title="{:t('余额')}" {if !$info['id'] || $info['tzjl_type']==1}checked{/if}/>
											{if $bid ==0}<input type="radio" name="info[tzjl_type]"  lay-filter="tzjl_type" value="2" title="{:t('积分')}" {if $info['id'] && $info['tzjl_type']==2}checked{/if}/>{/if}
											<input type="radio" name="info[tzjl_type]"  lay-filter="tzjl_type" value="3" title="{:t('佣金')}" {if $info['id'] && $info['tzjl_type']==3}checked{/if}/>
											<input type="radio" name="info[tzjl_type]"  lay-filter="tzjl_type" value="4" title="{:t('优惠券')}" {if $info['id'] && $info['tzjl_type']==4}checked{/if}/>
										</div>
										<div class="layui-form-mid layui-word-aux" style="margin-left:10px;">拼团成功后赠送团长</div>
									</div>
									<div class="layui-form-item" id="member_money" {if $info && $info['tzjl_type']!=1}style="display:none"{/if}>
										<label class="layui-form-label">团长奖励{:t('余额')}：</label>
										<div class="layui-input-inline">
											<input type="text" name="info[member_money]" value="{$info['id']?$info['member_money']:'0'}" class="layui-input">
										</div>
										<div class="layui-form-mid layui-word-aux">拼团成功后赠送团长多少{:t('余额')}</div>
									</div>
  									{if $bid ==0}
  									<div class="layui-form-item" id="leaderscore" {if $info['tzjl_type']!=2}style="display:none"{/if}>
										<label class="layui-form-label">团长奖励{:t('积分')}：</label>
										<div class="layui-input-inline">
											<input type="text" name="info[leaderscore]" value="{$info['id']?$info['leaderscore']:'0'}" class="layui-input">
										</div>
										<div class="layui-form-mid layui-word-aux">拼团成功后赠送团长多少{:t('积分')}</div>
									</div>
  									{/if}
									<div class="layui-form-item" id="zstzcommission" {if $info['tzjl_type']!=3}style="display:none"{/if}>
										<label class="layui-form-label">团长奖励{:t('佣金')}：</label>
										<div class="layui-input-inline">
											<input type="text" name="info[zstzcommission]" value="{$info['id']?$info['zstzcommission']:'0'}" class="layui-input">
										</div>
										<div class="layui-form-mid layui-word-aux">拼团成功后赠送团长多少{:t('佣金')}</div>
									</div>
									<div class="layui-form-item" id="tzyhq" {if $info['tzjl_type']!=4}style="display:none"{/if}>
										<label class="layui-form-label">团长奖励{:t('优惠券')}：</label>
										<div class="layui-input-inline">
											<input type="text" name="info[zstz_yhqids]" value="{$info[zstz_yhqids]}" class="layui-input">
										
										</div>
										<div class="layui-form-mid layui-word-aux" >请填写{:t('优惠券')}id,多个请用逗号隔开如：112,110,请确认{:t('优惠券')}的有效期、库存有效</div>
									</div>
									
									<div class="layui-form-item">
										<label class="layui-form-label">分享奖励：</label>
										<div class="layui-input-inline" style="width:420px">
											<input type="radio" name="info[sharejl_type]"  lay-filter="sharejl_type" value="1" title="{:t('余额')}" {if !$info['id'] || $info['sharejltype']==1}checked{/if}/>
											{if $bid ==0}<input type="radio" name="info[sharejl_type]"  lay-filter="sharejl_type" value="2" title="{:t('积分')}" {if $info['id'] && $info['sharejltype']==2}checked{/if}/>{/if}
											<input type="radio" name="info[sharejl_type]"  lay-filter="sharejl_type" value="3" title="{:t('佣金')}" {if $info['id'] && $info['sharejltype']==3}checked{/if}/>
											<input type="radio" name="info[sharejl_type]"  lay-filter="sharejl_type" value="4" title="{:t('优惠券')}" {if $info['id'] && $info['sharejltype']==4}checked{/if}/>
										</div>
									</div>
									<div class="layui-form-item" id="sharemoney" {if $info && $info['sharejltype']!=1}style="display:none"{/if}>
										<label class="layui-form-label">分享奖励{:t('余额')}：</label>
										<div class="layui-input-inline">
											<input type="text" name="info[sharemoney]" value="{$info['id']?$info['sharemoney']:'0'}" class="layui-input">
										</div>
										<div class="layui-form-mid layui-word-aux">分享后拼团成功奖励多少{:t('余额')}</div>
									</div>
  									{if $bid ==0}
									<div class="layui-form-item" id="sharescore" {if  $info['sharejltype']!=2}style="display:none"{/if}>
										<label class="layui-form-label">分享奖励{:t('积分')}：</label>
										<div class="layui-input-inline">
											<input type="text" name="info[sharescore]" value="{$info['id']?$info['sharescore']:'0'}" class="layui-input">
										</div>
										<div class="layui-form-mid layui-word-aux">分享后拼团成功奖励多少{:t('积分')}</div>
									</div>
  									{/if}
									<div class="layui-form-item" id="sharecommission" {if  $info['sharejltype']!=3}style="display:none"{/if}>
										<label class="layui-form-label">分享奖励{:t('佣金')}：</label>
										<div class="layui-input-inline">
											<input type="text" name="info[sharecommission]" value="{$info['id']?$info['sharecommission']:'0'}" class="layui-input">
										</div>
										<div class="layui-form-mid layui-word-aux">分享后拼团成功奖励多少{:t('佣金')}</div>
									</div>
									<div class="layui-form-item" id="sharejlyhq" {if $info['sharejltype']!=4}style="display:none"{/if}>
										<label class="layui-form-label">奖励{:t('优惠券')}：</label>
										<div class="layui-input-inline">
											<input type="text" name="info[share_yhqids]" value="{$info[share_yhqids]}" class="layui-input">
										</div>
										<div class="layui-form-mid layui-word-aux">请填写{:t('优惠券')}id,多个请用逗号隔开如：112,110,请确认{:t('优惠券')}的有效期、库存有效</div>
									</div>

									<div class="layui-form-item">
										<label class="layui-form-label">中奖奖励：</label>
										<div class="layui-input-inline" style="width:420px">
											<input type="radio" name="info[zjjl_type]"  lay-filter="zjjl_type" value="1" title="{:t('余额')}" {if !$info['id'] || $info['zjjl_type']==1}checked{/if}/>
											{if $bid ==0}<input type="radio" name="info[zjjl_type]"  lay-filter="zjjl_type" value="2" title="{:t('积分')}" {if $info['id'] && $info['zjjl_type']==2}checked{/if}/>{/if}
											<input type="radio" name="info[zjjl_type]"  lay-filter="zjjl_type" value="3" title="{:t('佣金')}" {if $info['id'] && $info['zjjl_type']==3}checked{/if}/>
											<input type="radio" name="info[zjjl_type]"  lay-filter="zjjl_type" value="4" title="{:t('优惠券')}" {if $info['id'] && $info['zjjl_type']==4}checked{/if}/>
										</div>
									</div>
									<div class="layui-form-item" id="zj_money" {if $info && $info['zjjl_type']!=1}style="display:none"{/if}>
										<label class="layui-form-label">中奖奖励{:t('余额')}：</label>
										<div class="layui-input-inline">
											<input type="text" name="info[zj_money]" value="{$info['id']?$info['zj_money']:'0'}" class="layui-input">
										</div>
										<div class="layui-form-mid layui-word-aux">拼团成功中奖者奖励多少{:t('余额')}</div>
									</div>
  									{if $bid ==0}
									<div class="layui-form-item" id="zjscore" {if $info['zjjl_type']!=2}style="display:none"{/if}>
										<label class="layui-form-label">中奖奖励{:t('积分')}：</label>
										<div class="layui-input-inline">
											<input type="text" name="info[zjscore]" value="{$info['id']?$info['zjscore']:'0'}" class="layui-input">
										</div>
										<div class="layui-form-mid layui-word-aux">拼团成功中奖者奖励多少{:t('积分')}</div>
									</div>
  									{/if}
									<div class="layui-form-item" id="zjcommission" {if $info['zjjl_type']!=3}style="display:none"{/if}>
										<label class="layui-form-label">中奖奖励{:t('佣金')}：</label>
										<div class="layui-input-inline">
											<input type="text" name="info[zjcommission]" value="{$info['id']?$info['zjcommission']:'0'}" class="layui-input">
										</div>
										<div class="layui-form-mid layui-word-aux">拼团成功中奖者奖励多少{:t('佣金')}</div>
									</div>
									<div class="layui-form-item" id="zjyhq" {if $info['zjjl_type']!=4}style="display:none"{/if}>
										<label class="layui-form-label">奖励{:t('优惠券')}：</label>
										<div class="layui-input-inline">
											<input type="text" name="info[zj_yhqids]" value="{$info[zj_yhqids]}" class="layui-input">
										</div>
										<div class="layui-form-mid layui-word-aux" >请填写{:t('优惠券')}id,多个请用逗号隔开如：112,110,请确认{:t('优惠券')}的有效期、库存有效</div>
									</div>
													
									<div class="layui-form-item">
										<label class="layui-form-label">中奖会员ID：</label>
										<div class="layui-input-inline">
											<input type="text" name="info[zjids]" value="{$info[zjids]}" class="layui-input">
										
										</div>
										<div class="layui-form-mid" style="color:red">设置会员ID后，此会员会中奖，多个请用逗号隔开如：112,110，ID数量不能超过中奖的人数</div>
									</div>
									<div class="layui-form-item">
										<label class="layui-form-label">不中奖会员ID：</label>
										<div class="layui-input-inline">
											<input type="text" name="info[bzids]" value="{$info[bzids]}" class="layui-input">
										</div>
										<div class="layui-form-mid" style="color:red">设置会员ID后，此会员将不会中奖，多个请用逗号隔开如：112,110,ID数量不能超过不中奖的人数</div>
									</div>
									<div class="layui-form-item">
										<label class="layui-form-label">开启时间限制：</label>
										<div class="layui-input-inline" style="width:420px">
											<input type="radio" name="info[isktdate]"  lay-filter="isktdate" value="0" title="关闭" {if !$info['id'] || $info['isktdate']==0}checked{/if}/>
											<input type="radio" name="info[isktdate]"  lay-filter="isktdate" value="1" title="开启" {if $info['id'] && $info['isktdate']==1}checked{/if}/>
										</div>
									</div>
									<div class="layui-form-item" {if !$info || $info['isktdate']==0}style="display:none"{/if} id="ktdate">
										<label class="layui-form-label">开团时间：</label>
										<div class="layui-input-block" style="margin-left:110px;width:600px">
											{foreach $systimeset as $v}
											<input type="checkbox" name="info[kaituan_time][]" {if in_array($v,$info['kaituan_time'])}checked{/if} value="{$v}" title="{if strlen($v)==1}0{/if}{$v}:00" >
											{/foreach}
										</div>
									</div>
									<div class="layui-form-item">
										<label class="layui-form-label">同时开团数量：</label>
										<div class="layui-input-inline">
											<input type="text" name="info[tsktnum]" value="{$info['id']?$info['tsktnum']:'0'}" class="layui-input">
										</div>
										<div class="layui-form-mid layui-word-aux">同时最多开团的数量，默认为0,不限制</div>
									</div>			
									{/if}

									{if !getcustom('plug_luckycollage')}
  									{if $bid ==0}
  									<div class="layui-form-item">
										<label class="layui-form-label">奖励{:t('积分')}：</label>
										<div class="layui-input-inline">
											<input type="text" name="info[leaderscore]" value="{$info['id']?$info['leaderscore']:'0'}" class="layui-input">
										</div>
										<div class="layui-form-mid layui-word-aux">拼团成功后赠送多少{:t('积分')}</div>
									</div>
  									{/if}
									{/if}

									{if getcustom('luckycollage_scoredk')}
									<div class="layui-form-item">
										<label class="layui-form-label">{:t('积分')}抵扣：</label>
										<div class="layui-input-block" style="width:800px">
											<input type="radio" name="info[scoredkmaxset]" value="0" {if !$info['id'] || $info['scoredkmaxset']==0}checked{/if} title="按照系统设置抵扣" lay-filter="scoredkmaxset">
											<input type="radio" name="info[scoredkmaxset]" value="1" {if $info['scoredkmaxset']==1}checked{/if} title="单独设置抵扣比例" lay-filter="scoredkmaxset">
											<input type="radio" name="info[scoredkmaxset]" value="2" {if $info['scoredkmaxset']==2}checked{/if} title="单独设置抵扣金额" lay-filter="scoredkmaxset">
											<input type="radio" name="info[scoredkmaxset]" value="-1" {if $info['scoredkmaxset']==-1}checked{/if} title="不可用{:t('积分')}抵扣" lay-filter="scoredkmaxset">
										</div>
									</div>
									<div id="scoredkmaxset1" {if $info['scoredkmaxset']!=1 && $info['scoredkmaxset']!=2}style="display:none"{/if}>
										<div class="layui-form-item">
											<label class="layui-form-label"></label>
											<div class="layui-input-inline layui-module-itemL">
											<div>最多抵扣(<span id="scoredkmaxunit">{$info['scoredkmaxset']==1?'%':'元'}</span>) </div>
												<input type="text" name="info[scoredkmaxval]" value="{$info.scoredkmaxval}" class="layui-input">
											</div>
										</div>
									</div>
									{/if}
									{if getcustom('luckycollage_zjjl')}
									<div class="layui-form-item">
										<label class="layui-form-label">中奖奖励：</label>
										<div class="layui-input-inline" style="width:420px">
											<input type="radio" name="info[zjjl_type]"  lay-filter="zjjl_type" value="1" title="{:t('余额')}" {if !$info['id'] || $info['zjjl_type']==1}checked{/if}/>
											{if $bid ==0}<input type="radio" name="info[zjjl_type]"  lay-filter="zjjl_type" value="2" title="{:t('积分')}" {if $info['id'] && $info['zjjl_type']==2}checked{/if}/>{/if}
											<input type="radio" name="info[zjjl_type]"  lay-filter="zjjl_type" value="3" title="{:t('佣金')}" {if $info['id'] && $info['zjjl_type']==3}checked{/if}/>
											<input type="radio" name="info[zjjl_type]"  lay-filter="zjjl_type" value="4" title="{:t('优惠券')}" {if $info['id'] && $info['zjjl_type']==4}checked{/if}/>
										</div>
									</div>
									<div class="layui-form-item zj_money_type" id="zj_money_type"  {if $info['zjjl_type']!=1}style="display:none"{/if}>
										<label class="layui-form-label">中奖{:t('余额')}类型：</label>
										<div class="layui-input-inline">
											<input type="radio" name="info[zj_money_type]"  lay-filter="zj_money_type" value="1" title="按比例" {if !$info['id'] || !$info['zj_money_type'] || ($info['id'] && $info['zj_money_type']==1)}checked{/if}/>
											<input type="radio" name="info[zj_money_type]"  lay-filter="zj_money_type" value="2" title="按金额" {if $info['id'] && $info['zj_money_type']==2}checked{/if}/>
										</div>
										<div class="layui-form-mid layui-word-aux">
										*按比例指该商品最低金额比例{:t('余额')} &nbsp;
										*按个数指用户每人都获得该{:t('余额')}</div>
									</div>
									<div class="layui-form-item zj_money_type"  id="zj_money_type1" {if $info['zj_money_type']!=1 || $info['zjjl_type']!=1}style="display:none"{/if}>
										<label class="layui-form-label">中奖{:t('余额')}比例：</label>
										<div class="layui-input-inline">
											<input type="text" name="info[zj_money_rate]" value="{$info['id']?$info['zj_money_rate']:'0'}" class="layui-input">
										</div>
										<div class="layui-form-mid layui-word-aux">% 拼团成功后赠送中奖者{:t('余额')}百分比 该商品最低金额的百分比</div>
									</div>
									<div class="layui-form-item" id="zj_money" {if $info && ($info['zj_money_type']!=2  || $info['zjjl_type']!=1)}style="display:none"{/if}>
										<label class="layui-form-label">中奖奖励{:t('余额')}：</label>
										<div class="layui-input-inline">
											<input type="text" name="info[zj_money]" value="{$info['id']?$info['zj_money']:'0'}" class="layui-input">
										</div>
										<div class="layui-form-mid layui-word-aux">拼团成功中奖者奖励多少{:t('余额')}</div>
									</div>
  									{if $bid == 0}
									  <div class="layui-form-item zjjlscore_type" id="zjjlscore_type"  {if $info['zjjl_type']!=2}style="display:none"{/if}>
										<label class="layui-form-label">中奖{:t('积分')}类型：</label>
										<div class="layui-input-inline">
											<input type="radio" name="info[zjjlscore_type]"  lay-filter="zjjlscore_type" value="1" title="按比例" {if !$info['id'] || !$info['zjjlscore_type'] || ($info['id'] && $info['zjjlscore_type']==1) }checked{/if}/>
											<input type="radio" name="info[zjjlscore_type]"  lay-filter="zjjlscore_type" value="2" title="按个数" {if $info['id'] && $info['zjjlscore_type']==2}checked{/if}/>
										</div>
										<div class="layui-form-mid layui-word-aux">
										*按比例指该商品最低金额比例{:t('积分')} &nbsp;
										*按个数指用户每人都获得该{:t('积分')}个数{$info['zjjlscore_type']}</div>
									</div>
									<div class="layui-form-item zjjlscore_type"  id="zjjlscore_type1" {if $info['zjjl_type']!=2 || $info['zjjlscore_type']!=1}style="display:none"{/if}>
										<label class="layui-form-label">中奖{:t('积分')}比例：</label>
										<div class="layui-input-inline">
											<input type="text" name="info[zjjlscore_rate]" value="{$info['id']?$info['zjjlscore_rate']:'0'}" class="layui-input">
										</div>
										<div class="layui-form-mid layui-word-aux">% 拼团成功后赠送中奖者{:t('积分')}百分比 该商品最低金额的百分比</div>
									</div>
									<div class="layui-form-item" id="zjscore" {if $info['zjjl_type']!=2 || $info['zjjlscore_type'] !=2}style="display:none"{/if}>
										<label class="layui-form-label">中奖奖励{:t('积分')}：</label>
										<div class="layui-input-inline">
											<input type="text" name="info[zjscore]" value="{$info['id']?$info['zjscore']:'0'}" class="layui-input">
										</div>
										<div class="layui-form-mid layui-word-aux">拼团成功中奖者奖励多少{:t('积分')}</div>
									</div>
									{/if}
									<div class="layui-form-item" id="zjcommission" {if $info['zjjl_type']!=3}style="display:none"{/if}>
										<label class="layui-form-label">中奖奖励{:t('佣金')}：</label>
										<div class="layui-input-inline">
											<input type="text" name="info[zjcommission]" value="{$info['id']?$info['zjcommission']:'0'}" class="layui-input">
										</div>
										<div class="layui-form-mid layui-word-aux">拼团成功中奖者奖励多少{:t('佣金')}</div>
									</div>
									<div class="layui-form-item" id="zjyhq" {if $info['zjjl_type']!=4}style="display:none"{/if}>
										<label class="layui-form-label">奖励{:t('优惠券')}：</label>
										<div class="layui-input-inline">
											<input type="text" name="info[zj_yhqids]" value="{$info[zj_yhqids]}" class="layui-input">
										</div>
										<div class="layui-form-mid layui-word-aux" >请填写{:t('优惠券')}id,多个请用逗号隔开如：112,110,请确认{:t('优惠券')}的有效期、库存有效</div>
									</div>
									{/if}<!--luckycollage_zjjl end-->
									{if getcustom('luckycollage_product_showtj')}
									<div class="layui-form-item">
									  <label class="layui-form-label">显示条件：</label>
									  <div class="layui-input-inline" style="width:800px">
										  <input type="checkbox" name="info[showtj][]" value="-1" title="所有人" lay-skin="primary" {if !$info['id'] || in_array('-1',$info['showtj'])}checked{/if}/>
										  <input type="checkbox" name="info[showtj][]" value="-2" title="未登录用户" lay-skin="primary" {if !$info['id'] || in_array('-2',$info['showtj'])}checked{/if}/>
										  <input type="checkbox" name="info[showtj][]" value="0" title="关注用户" lay-skin="primary" {if in_array('0',$info['showtj'])}checked{/if}/>
										  {foreach $levellist as $v}
										  <input type="checkbox" name="info[showtj][]" value="{$v.id}" title="{$v.name}" lay-skin="primary" {if in_array($v['id'],$info['showtj'])}checked{/if}/>
										  {/foreach}
									  </div>
									</div>
									<div class="layui-form-item">
									  <label class="layui-form-label">无权限跳转：</label>
									  <div class="layui-input-inline" style="width:200px">
										  <input type="text" name="info[noauth_tourl]" class="layui-input" value="{$info.noauth_tourl}" id="noauth_tourl">
									  </div>
									  <div class="layui-btn layui-btn-primary" style="float:left" onclick="chooseUrl2('noauth_tourl')">选择链接</div>
									  <div class="layui-form-mid layui-word-aux" style="margin-left: 10px">无权限跳转指定链接</div>
									</div>
									{/if}


									<!--	中奖用户，奖励发放伴随系统设置发放时间								-->
										<h3>中奖用户分销设置</h3>
										<hr>
								    {if $bid==0}
									<div class="layui-form-item">
										<label class="layui-form-label">分销设置：</label>
										<div class="layui-input-block" style="width:900px">
											<input type="radio" name="info[commissionset]" value="0" {if !$info['id'] || $info['commissionset']==0}checked{/if} title="按照{:t('会员')}等级" lay-filter="commissionset">
											<input type="radio" name="info[commissionset]" value="1" {if $info['commissionset']==1}checked{/if} title="单独设置提成比例" lay-filter="commissionset">
											<input type="radio" name="info[commissionset]" value="2" {if $info['commissionset']==2}checked{/if} title="单独设置提成金额" lay-filter="commissionset">
											<input type="radio" name="info[commissionset]" value="3" {if $info['commissionset']==3}checked{/if} title="分销送{:t('积分')}" lay-filter="commissionset">
											<span  {if $info['lvprice']==0}style="display:none"{/if} id="commissionset4input">
											<input type="radio" name="info[commissionset]" value="4" {if $info['commissionset']==4}checked{/if} title="按差价拿{:t('佣金')}" lay-filter="commissionset">
											</span>
											<input type="radio" name="info[commissionset]" value="-1" {if $info['commissionset']==-1}checked{/if} title="不参与分销" lay-filter="commissionset">
										</div>
										<div class="layui-form-mid layui-word-aux">按照{:t('会员')}等级：按照{:t('会员')}等级中设置的提成比例进行提成分配，提成=对应{:t('会员')}等级的提成比例×{$jiesuantypeDesc}×购买数量<br>
										单独设置提成比例：按照单独设置的提成比例进行提成分配，提成=设置的百分比×{$jiesuantypeDesc}×购买数量<br>
										单独设置提成金额：按照单独设置的提成金额进行提成分配，提成=提成金额×购买数量<br>
										分销送{:t('积分')}：分销提成不给{:t('佣金')}而是给{:t('积分')}，得到的积分=提成{:t('积分')}×购买数量<br>
										<span id="commissionset4tips" {if $info['lvprice']==0}style="display:none"{/if}>按差价拿{:t('佣金')}：当开启会员价时，不同的会员等级存在价格差，如果上级与下级之间存在价格差，则此价格差作为{:t('佣金')}返给上级</span>
										</div>
									</div>
									{php}
									$commissiondata1 = json_decode($info['commissiondata1'],true);
									if(!$commissiondata1) $commissiondata1 = [];
									$commissiondata2 = json_decode($info['commissiondata2'],true);
									if(!$commissiondata2) $commissiondata2 = [];
									$commissiondata3 = json_decode($info['commissiondata3'],true);
									if(!$commissiondata3) $commissiondata3 = [];
									{/php}
									<div id="commissionset1" {if $info['commissionset']!=1}style="display:none"{/if}>
										{if !$aglevellist}
										<div class="layui-form-item">
											<label class="layui-form-label">提成比例：</label>
											<div class="layui-form-mid" style="color:red">未设置具有分销权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置分销权限</div>
										</div>
										{else}
										{foreach $aglevellist as $level}
										<div class="layui-form-item">
											<label class="layui-form-label">{$level.name}：</label>
											<div class="layui-input-inline layui-module-itemL">
												<div> 一级(%) </div>
												<input type="text" name="commissiondata1[{$level.id}][commission1]" class="layui-input" value="{$commissiondata1[$level['id']]['commission1']}">
											</div>
											{if $level['can_agent']>1}
											<div class="layui-input-inline layui-module-itemL">
												<div>二级(%)</div>
												<input type="text" name="commissiondata1[{$level.id}][commission2]" class="layui-input" value="{$commissiondata1[$level['id']]['commission2']}">
											</div>
											{/if}
											{if $level['can_agent']>2}
											<div class="layui-input-inline layui-module-itemL">
												<div>三级(%)</div>
												<input type="text" name="commissiondata1[{$level.id}][commission3]" class="layui-input" value="{$commissiondata1[$level['id']]['commission3']}">
											</div>
											{/if}
										</div>
										{/foreach}
										{/if}
									</div>
									<div id="commissionset2" {if $info['commissionset']!=2}style="display:none"{/if}>
										{if !$aglevellist}
										<div class="layui-form-item">
											<label class="layui-form-label">提成金额：</label>
											<div class="layui-form-mid" style="color:red">未设置具有分销权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置分销权限</div>
										</div>
										{else}
										{foreach $aglevellist as $level}
										<div class="layui-form-item">
											<label class="layui-form-label">{$level.name}：</label>
											<div class="layui-input-inline layui-module-itemL">
												<div> 一级(元) </div>
												<input type="text" name="commissiondata2[{$level.id}][commission1]" class="layui-input" value="{$commissiondata2[$level['id']]['commission1']}">
											</div>
											{if $level['can_agent']>1}
											<div class="layui-input-inline layui-module-itemL">
												<div>二级(元)</div>
												<input type="text" name="commissiondata2[{$level.id}][commission2]" class="layui-input" value="{$commissiondata2[$level['id']]['commission2']}">
											</div>
											{/if}
											{if $level['can_agent']>2}
											<div class="layui-input-inline layui-module-itemL">
												<div>三级(元)</div>
												<input type="text" name="commissiondata2[{$level.id}][commission3]" class="layui-input" value="{$commissiondata2[$level['id']]['commission3']}">
											</div>
											{/if}
										</div>
										{/foreach}
										{/if}
									</div>
									<div id="commissionset3" {if $info['commissionset']!=3}style="display:none"{/if}>
										{if !$aglevellist}
										<div class="layui-form-item">
											<label class="layui-form-label">提成{:t('积分')}：</label>
											<div class="layui-form-mid" style="color:red">未设置具有分销权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置分销权限</div>
										</div>
										{else}
										{foreach $aglevellist as $level}
										<div class="layui-form-item">
											<label class="layui-form-label">{$level.name}：</label>
											<div class="layui-input-inline layui-module-itemL">
												<div> 一级({:t('积分')}) </div>
												<input type="text" name="commissiondata3[{$level.id}][commission1]" class="layui-input" value="{$commissiondata3[$level['id']]['commission1']}">
											</div>
											{if $level['can_agent']>1}
											<div class="layui-input-inline layui-module-itemL">
												<div>二级({:t('积分')})</div>
												<input type="text" name="commissiondata3[{$level.id}][commission2]" class="layui-input" value="{$commissiondata3[$level['id']]['commission2']}">
											</div>
											{/if}
											{if $level['can_agent']>2}
											<div class="layui-input-inline layui-module-itemL">
												<div>三级({:t('积分')})</div>
												<input type="text" name="commissiondata3[{$level.id}][commission3]" class="layui-input" value="{$commissiondata3[$level['id']]['commission3']}">
											</div>
											{/if}
										</div>
										{/foreach}
										{/if}
									</div>
									{/if}<!--分销设置 end-->

									{if getcustom('luckycollage_fenhong') && $bid==0 && ($auth_data=='all' || in_array('gdfenhong',$auth_data) || in_array('teamfenhong',$auth_data) || in_array('areafenhong',$auth_data))}
									<div class="layui-form-item">
										<label class="layui-form-label">分红设置：</label>
										<div class="layui-input-block" style="width:800px">
											<input type="radio" name="info[fenhongset]" value="1" {if !$info['id'] || $info['fenhongset']==1}checked{/if} title="参与" lay-filter="fenhongset">
											<input type="radio" name="info[fenhongset]" value="0" {if $info['id'] && $info['fenhongset']==0}checked{/if} title="不参与" lay-filter="fenhongset">
										</div>
									</div>
									<div id="fenhongset" {if $info['id'] && $info['fenhongset']==0}style="display:none"{/if}>
										{if $auth_data=='all' || in_array('teamfenhong',$auth_data)}
										<div class="layui-form-item">
											<label class="layui-form-label">团队分红：</label>
											<div class="layui-input-block" style="width:700px">
												<input type="radio" name="info[teamfenhongset]" value="0" {if !$info['id'] || $info['teamfenhongset']==0}checked{/if} title="按照{:t('会员')}等级" lay-filter="teamfenhongset">
												<input type="radio" name="info[teamfenhongset]" value="1" {if $info['teamfenhongset']==1}checked{/if} title="单独设置分红比例" lay-filter="teamfenhongset">
												<input type="radio" name="info[teamfenhongset]" value="2" {if $info['teamfenhongset']==2}checked{/if} title="单独设置分红金额" lay-filter="teamfenhongset">
												<input type="radio" name="info[teamfenhongset]" value="-1" {if $info['teamfenhongset']==-1}checked{/if} title="不参与分红" lay-filter="teamfenhongset">
											</div>
											<div class="layui-form-mid layui-word-aux">开启后可以拿到团队中所有{:t('会员')}的所有商城订单的分红金额或比例，请先在[{:t('会员')}]-[等级及分销]设置分红级数</div>
										</div>
										{php}
										$teamfenhongdata1 = json_decode($info['teamfenhongdata1'],true);
										if(!$teamfenhongdata1) $teamfenhongdata1 = [];
										$teamfenhongdata2 = json_decode($info['teamfenhongdata2'],true);
										if(!$teamfenhongdata2) $teamfenhongdata2  = [];
										{/php}
										<div id="teamfenhongset1" {if $info['teamfenhongset']!=1}style="display:none"{/if}>
											<div class="layui-form-item">
												<label class="layui-form-label">分红比例：</label>
												{if !$teamlevellist}<div class="layui-form-mid" style="color:red">未设置具有团队分红权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置</div>{/if}
												{foreach $teamlevellist as $level}
												<div class="layui-input-inline layui-module-itemL">
													<div> {$level.name}(%) </div>
													<input type="text" name="teamfenhongdata1[{$level.id}][commission]" class="layui-input" value="{$teamfenhongdata1[$level['id']]['commission']}">
												</div>
												{/foreach}
											</div>
										</div>
										<div id="teamfenhongset2" {if $info['teamfenhongset']!=2}style="display:none"{/if}>
											<div class="layui-form-item">
												<label class="layui-form-label">分红金额：</label>
												{if !$teamlevellist}<div class="layui-form-mid" style="color:red">未设置具有团队分红权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置</div>{/if}
												{foreach $teamlevellist as $level}
												<div class="layui-input-inline layui-module-itemL">
													<div> {$level.name}(元) </div>
													<input type="text" name="teamfenhongdata2[{$level.id}][commission]" class="layui-input" value="{$teamfenhongdata2[$level['id']]['commission']}">
												</div>
												{/foreach}
											</div>
										</div>
										{/if}
										{if $auth_data=='all' || in_array('gdfenhong',$auth_data)}
										<div class="layui-form-item">
											<label class="layui-form-label">股东分红：</label>
											<div class="layui-input-block" style="width:700px">
												<input type="radio" name="info[gdfenhongset]" value="0" {if !$info['id'] || $info['gdfenhongset']==0}checked{/if} title="按照会员等级" lay-filter="gdfenhongset">
												<input type="radio" name="info[gdfenhongset]" value="1" {if $info['gdfenhongset']==1}checked{/if} title="单独设置分红比例" lay-filter="gdfenhongset">
												<input type="radio" name="info[gdfenhongset]" value="2" {if $info['gdfenhongset']==2}checked{/if} title="单独设置分红金额" lay-filter="gdfenhongset">
												<input type="radio" name="info[gdfenhongset]" value="-1" {if $info['gdfenhongset']==-1}checked{/if} title="不参与分红" lay-filter="gdfenhongset">
											</div>
											<div class="layui-form-mid layui-word-aux">用于股东分红或合伙人分红，开启后相应等级的所有{:t('会员')}平均分摊设置的分红金额或比例</div>
										</div>
										{php}
										$gdfenhongdata1 = json_decode($info['gdfenhongdata1'],true);
										if(!$gdfenhongdata1) $gdfenhongdata1 = [];
										$gdfenhongdata2 = json_decode($info['gdfenhongdata2'],true);
										if(!$gdfenhongdata2) $gdfenhongdata2  = [];
										{/php}
										<div id="gdfenhongset1" {if $info['gdfenhongset']!=1}style="display:none"{/if}>
											<div class="layui-form-item">
												<label class="layui-form-label">分红比例：</label>
												{if !$gdlevellist}<div class="layui-form-mid" style="color:red">未设置具有股东分红权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置</div>{/if}
												{foreach $gdlevellist as $level}
												<div class="layui-input-inline layui-module-itemL">
													<div> {$level.name}(%) </div>
													<input type="text" name="gdfenhongdata1[{$level.id}][commission]" class="layui-input" value="{$gdfenhongdata1[$level['id']]['commission']}">
												</div>
												{/foreach}
											</div>
										</div>
										<div id="gdfenhongset2" {if $info['gdfenhongset']!=2}style="display:none"{/if}>
											<div class="layui-form-item">
												<label class="layui-form-label">分红金额：</label>
												{if !$gdlevellist}<div class="layui-form-mid" style="color:red">未设置具有股东分红权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置</div>{/if}
												{foreach $gdlevellist as $level}
												<div class="layui-input-inline layui-module-itemL">
													<div> {$level.name}(元) </div>
													<input type="text" name="gdfenhongdata2[{$level.id}][commission]" class="layui-input" value="{$gdfenhongdata2[$level['id']]['commission']}">
												</div>
												{/foreach}
											</div>
										</div>
										{/if}
										{if $auth_data=='all' || in_array('areafenhong',$auth_data)}
										<div class="layui-form-item">
											<label class="layui-form-label">区域代理分红：</label>
											<div class="layui-input-block" style="width:700px">
												<input type="radio" name="info[areafenhongset]" value="0" {if !$info['id'] || $info['areafenhongset']==0}checked{/if} title="按照会员等级" lay-filter="areafenhongset">
												<input type="radio" name="info[areafenhongset]" value="1" {if $info['areafenhongset']==1}checked{/if} title="单独设置分红比例" lay-filter="areafenhongset">
												<input type="radio" name="info[areafenhongset]" value="2" {if $info['areafenhongset']==2}checked{/if} title="单独设置分红金额" lay-filter="areafenhongset">
												<input type="radio" name="info[areafenhongset]" value="-1" {if $info['areafenhongset']==-1}checked{/if} title="不参与分红" lay-filter="areafenhongset">
											</div>
											<div class="layui-form-mid layui-word-aux">设置分红比例或分红金额后该等级的同一个代理区域的人平均分摊所有商城内该区域的订单的分红提成比例或分红金额</div>
										</div>
										{php}
										$areafenhongdata1 = json_decode($info['areafenhongdata1'],true);
										if(!$areafenhongdata1) $areafenhongdata1 = [];
										$areafenhongdata2 = json_decode($info['areafenhongdata2'],true);
										if(!$areafenhongdata2) $areafenhongdata2  = [];
										{/php}
										<div id="areafenhongset1" {if $info['areafenhongset']!=1}style="display:none"{/if}>
											<div class="layui-form-item">
												<label class="layui-form-label">分红比例：</label>
												{if !$areafhlevellist}<div class="layui-form-mid" style="color:red">未设置具有区域代理分红权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置</div>{/if}
												{foreach $areafhlevellist as $level}
												<div class="layui-input-inline layui-module-itemL">
													<div> {$level.name}(%) </div>
													<input type="text" name="areafenhongdata1[{$level.id}][commission]" class="layui-input" value="{$areafenhongdata1[$level['id']]['commission']}">
												</div>
												{/foreach}
											</div>
										</div>
										<div id="areafenhongset2" {if $info['areafenhongset']!=2}style="display:none"{/if}>
											<div class="layui-form-item">
												<label class="layui-form-label">分红金额：</label>
												{if !$areafhlevellist}<div class="layui-form-mid" style="color:red">未设置具有区域代理分红权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置</div>{/if}
												{foreach $areafhlevellist as $level}
												<div class="layui-input-inline layui-module-itemL">
													<div> {$level.name}(元) </div>
													<input type="text" name="areafenhongdata2[{$level.id}][commission]" class="layui-input" value="{$areafenhongdata2[$level['id']]['commission']}">
												</div>
												{/foreach}
											</div>
										</div>
										{/if}
									</div>
									{/if}

								{if getcustom('luckycollage_fail_commission')}
								<!--	未中奖用户分销设置，奖励发放伴随拼团开奖发放								-->
								<h3>未中奖用户分销设置</h3>
								<hr>
								{if $bid==0}
								<div class="layui-form-item">
									<label class="layui-form-label">分销设置：</label>
									<div class="layui-input-block" style="width:900px">
										<input type="radio" name="info[fail_commissionset]" value="0" {if !$info['id'] || $info['fail_commissionset']==0}checked{/if} title="按照{:t('会员')}等级" lay-filter="fail_commissionset">
										<input type="radio" name="info[fail_commissionset]" value="1" {if $info['fail_commissionset']==1}checked{/if} title="单独设置提成比例" lay-filter="fail_commissionset">
										<input type="radio" name="info[fail_commissionset]" value="2" {if $info['fail_commissionset']==2}checked{/if} title="单独设置提成金额" lay-filter="fail_commissionset">
										<input type="radio" name="info[fail_commissionset]" value="3" {if $info['fail_commissionset']==3}checked{/if} title="分销送{:t('积分')}" lay-filter="fail_commissionset">
										<span  {if $info['lvprice']==0}style="display:none"{/if} id="fail_commissionset4input">
										<input type="radio" name="info[fail_commissionset]" value="4" {if $info['fail_commissionset']==4}checked{/if} title="按差价拿{:t('佣金')}" lay-filter="fail_commissionset">
										</span>
										<input type="radio" name="info[fail_commissionset]" value="-1" {if $info['fail_commissionset']==-1}checked{/if} title="不参与分销" lay-filter="fail_commissionset">
									</div>
									<div class="layui-form-mid layui-word-aux">
										<span style="color: red">拼团失败分销佣金会在拼团开奖时重新计算并发放</span><br>
										按照{:t('会员')}等级：按照{:t('会员')}等级中设置的提成比例进行提成分配，提成=对应{:t('会员')}等级的提成比例×{$jiesuantypeDesc}×购买数量<br>
										单独设置提成比例：按照单独设置的提成比例进行提成分配，提成=设置的百分比×{$jiesuantypeDesc}×购买数量<br>
										单独设置提成金额：按照单独设置的提成金额进行提成分配，提成=提成金额×购买数量<br>
										分销送{:t('积分')}：分销提成不给{:t('佣金')}而是给{:t('积分')}，得到的积分=提成{:t('积分')}×购买数量<br>
										<span id="fail_commissionset4tips" {if $info['lvprice']==0}style="display:none"{/if}>按差价拿{:t('佣金')}：当开启会员价时，不同的会员等级存在价格差，如果上级与下级之间存在价格差，则此价格差作为{:t('佣金')}返给上级</span>
									</div>
								</div>
								{php}
								$fail_commissiondata1 = json_decode($info['fail_commissiondata1'],true);
								if(!$fail_commissiondata1) $fail_commissiondata1 = [];
								$fail_commissiondata2 = json_decode($info['fail_commissiondata2'],true);
								if(!$fail_commissiondata2) $fail_commissiondata2 = [];
								$fail_commissiondata3 = json_decode($info['fail_commissiondata3'],true);
								if(!$fail_commissiondata3) $fail_commissiondata3 = [];
								{/php}
								<div id="fail_commissionset1" {if $info['fail_commissionset']!=1}style="display:none"{/if}>
								{if !$aglevellist}
								<div class="layui-form-item">
									<label class="layui-form-label">提成比例：</label>
									<div class="layui-form-mid" style="color:red">未设置具有分销权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置分销权限</div>
								</div>
								{else}
								{foreach $aglevellist as $level}
								<div class="layui-form-item">
									<label class="layui-form-label">{$level.name}：</label>
									<div class="layui-input-inline layui-module-itemL">
										<div> 一级(%) </div>
										<input type="text" name="fail_commissiondata1[{$level.id}][commission1]" class="layui-input" value="{$fail_commissiondata1[$level['id']]['commission1']}">
									</div>
									{if $level['can_agent']>1}
									<div class="layui-input-inline layui-module-itemL">
										<div>二级(%)</div>
										<input type="text" name="fail_commissiondata1[{$level.id}][commission2]" class="layui-input" value="{$fail_commissiondata1[$level['id']]['commission2']}">
									</div>
									{/if}
									{if $level['can_agent']>2}
									<div class="layui-input-inline layui-module-itemL">
										<div>三级(%)</div>
										<input type="text" name="fail_commissiondata1[{$level.id}][commission3]" class="layui-input" value="{$fail_commissiondata1[$level['id']]['commission3']}">
									</div>
									{/if}
								</div>
								{/foreach}
								{/if}
								</div>
								<div id="fail_commissionset2" {if $info['fail_commissionset']!=2}style="display:none"{/if}>
								{if !$aglevellist}
								<div class="layui-form-item">
									<label class="layui-form-label">提成金额：</label>
									<div class="layui-form-mid" style="color:red">未设置具有分销权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置分销权限</div>
								</div>
								{else}
								{foreach $aglevellist as $level}
								<div class="layui-form-item">
									<label class="layui-form-label">{$level.name}：</label>
									<div class="layui-input-inline layui-module-itemL">
										<div> 一级(元) </div>
										<input type="text" name="fail_commissiondata2[{$level.id}][commission1]" class="layui-input" value="{$fail_commissiondata2[$level['id']]['commission1']}">
									</div>
									{if $level['can_agent']>1}
									<div class="layui-input-inline layui-module-itemL">
										<div>二级(元)</div>
										<input type="text" name="fail_commissiondata2[{$level.id}][commission2]" class="layui-input" value="{$fail_commissiondata2[$level['id']]['commission2']}">
									</div>
									{/if}
									{if $level['can_agent']>2}
									<div class="layui-input-inline layui-module-itemL">
										<div>三级(元)</div>
										<input type="text" name="fail_commissiondata2[{$level.id}][commission3]" class="layui-input" value="{$fail_commissiondata2[$level['id']]['commission3']}">
									</div>
									{/if}
								</div>
								{/foreach}
								{/if}
								</div>
								<div id="fail_commissionset3" {if $info['fail_commissionset']!=3}style="display:none"{/if}>
								{if !$aglevellist}
								<div class="layui-form-item">
									<label class="layui-form-label">提成{:t('积分')}：</label>
									<div class="layui-form-mid" style="color:red">未设置具有分销权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置分销权限</div>
								</div>
								{else}
								{foreach $aglevellist as $level}
								<div class="layui-form-item">
									<label class="layui-form-label">{$level.name}：</label>
									<div class="layui-input-inline layui-module-itemL">
										<div> 一级({:t('积分')}) </div>
										<input type="text" name="fail_commissiondata3[{$level.id}][commission1]" class="layui-input" value="{$fail_commissiondata3[$level['id']]['commission1']}">
									</div>
									{if $level['can_agent']>1}
									<div class="layui-input-inline layui-module-itemL">
										<div>二级({:t('积分')})</div>
										<input type="text" name="fail_commissiondata3[{$level.id}][commission2]" class="layui-input" value="{$fail_commissiondata3[$level['id']]['commission2']}">
									</div>
									{/if}
									{if $level['can_agent']>2}
									<div class="layui-input-inline layui-module-itemL">
										<div>三级({:t('积分')})</div>
										<input type="text" name="fail_commissiondata3[{$level.id}][commission3]" class="layui-input" value="{$fail_commissiondata3[$level['id']]['commission3']}">
									</div>
									{/if}
								</div>
								{/foreach}
								{/if}
								</div>
								{/if}<!--分销设置 end-->
								<!-- 失败分红设置 -->
								{if $bid==0 && $luckycollage_fail_fenhong && ($auth_data=='all' || in_array('gdfenhong',$auth_data) || in_array('teamfenhong',$auth_data) || in_array('areafenhong',$auth_data))}
								<div class="layui-form-item">
									<label class="layui-form-label">分红设置：</label>
									<div class="layui-input-block" style="width:800px">
										<input type="radio" name="info[fail_fenhongset]" value="1" {if !$info['id'] || $info['fail_fenhongset']==1}checked{/if} title="参与" lay-filter="fail_fenhongset">
										<input type="radio" name="info[fail_fenhongset]" value="0" {if $info['id'] && $info['fail_fenhongset']==0}checked{/if} title="不参与" lay-filter="fail_fenhongset">
									</div>
								</div>
								<div id="fail_fenhongset" {if $info['id'] && $info['fail_fenhongset']==0}style="display:none"{/if}>
								{if $auth_data=='all' || in_array('teamfenhong',$auth_data)}
								<div class="layui-form-item">
									<label class="layui-form-label">团队分红：</label>
									<div class="layui-input-block" style="width:700px">
										<input type="radio" name="info[fail_teamfenhongset]" value="0" {if !$info['id'] || $info['fail_teamfenhongset']==0}checked{/if} title="按照{:t('会员')}等级" lay-filter="fail_teamfenhongset">
										<input type="radio" name="info[fail_teamfenhongset]" value="1" {if $info['fail_teamfenhongset']==1}checked{/if} title="单独设置分红比例" lay-filter="fail_teamfenhongset">
										<input type="radio" name="info[fail_teamfenhongset]" value="2" {if $info['fail_teamfenhongset']==2}checked{/if} title="单独设置分红金额" lay-filter="fail_teamfenhongset">
										<input type="radio" name="info[fail_teamfenhongset]" value="-1" {if $info['fail_teamfenhongset']==-1}checked{/if} title="不参与分红" lay-filter="fail_teamfenhongset">
									</div>
									<div class="layui-form-mid layui-word-aux">开启后可以拿到团队中所有{:t('会员')}的所有商城订单的分红金额或比例，请先在[{:t('会员')}]-[等级及分销]设置分红级数</div>
								</div>
								{php}
								$fail_teamfenhongdata1 = json_decode($info['fail_teamfenhongdata1'],true);
								if(!$fail_teamfenhongdata1) $fail_teamfenhongdata1 = [];
								$fail_teamfenhongdata2 = json_decode($info['fail_teamfenhongdata2'],true);
								if(!$fail_teamfenhongdata2) $fail_teamfenhongdata2  = [];
								{/php}
								<div id="fail_teamfenhongset1" {if $info['fail_teamfenhongset']!=1}style="display:none"{/if}>
									<div class="layui-form-item">
										<label class="layui-form-label">分红比例：</label>
										{if !$teamlevellist}<div class="layui-form-mid" style="color:red">未设置具有团队分红权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置</div>{/if}
										{foreach $teamlevellist as $level}
										<div class="layui-input-inline layui-module-itemL">
											<div> {$level.name}(%) </div>
											<input type="text" name="fail_teamfenhongdata1[{$level.id}][commission]" class="layui-input" value="{$fail_teamfenhongdata1[$level['id']]['commission']}">
										</div>
										{/foreach}
									</div>
								</div>
								<div id="fail_teamfenhongset2" {if $info['fail_teamfenhongset']!=2}style="display:none"{/if}>
									<div class="layui-form-item">
										<label class="layui-form-label">分红金额：</label>
										{if !$teamlevellist}<div class="layui-form-mid" style="color:red">未设置具有团队分红权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置</div>{/if}
										{foreach $teamlevellist as $level}
										<div class="layui-input-inline layui-module-itemL">
											<div> {$level.name}(元) </div>
											<input type="text" name="fail_teamfenhongdata2[{$level.id}][commission]" class="layui-input" value="{$fail_teamfenhongdata2[$level['id']]['commission']}">
										</div>
										{/foreach}
									</div>
								</div>
								{/if}
								{if $auth_data=='all' || in_array('gdfenhong',$auth_data)}
								<div class="layui-form-item">
									<label class="layui-form-label">股东分红：</label>
									<div class="layui-input-block" style="width:700px">
										<input type="radio" name="info[fail_gdfenhongset]" value="0" {if !$info['id'] || $info['fail_gdfenhongset']==0}checked{/if} title="按照会员等级" lay-filter="fail_gdfenhongset">
										<input type="radio" name="info[fail_gdfenhongset]" value="1" {if $info['fail_gdfenhongset']==1}checked{/if} title="单独设置分红比例" lay-filter="fail_gdfenhongset">
										<input type="radio" name="info[fail_gdfenhongset]" value="2" {if $info['fail_gdfenhongset']==2}checked{/if} title="单独设置分红金额" lay-filter="fail_gdfenhongset">
										<input type="radio" name="info[fail_gdfenhongset]" value="-1" {if $info['fail_gdfenhongset']==-1}checked{/if} title="不参与分红" lay-filter="fail_gdfenhongset">
									</div>
									<div class="layui-form-mid layui-word-aux">用于股东分红或合伙人分红，开启后相应等级的所有{:t('会员')}平均分摊设置的分红金额或比例</div>
								</div>
								{php}
								$fail_gdfenhongdata1 = json_decode($info['fail_gdfenhongdata1'],true);
								if(!$fail_gdfenhongdata1) $fail_gdfenhongdata1 = [];
								$fail_gdfenhongdata2 = json_decode($info['fail_gdfenhongdata2'],true);
								if(!$fail_gdfenhongdata2) $fail_gdfenhongdata2  = [];
								{/php}
								<div id="fail_gdfenhongset1" {if $info['fail_gdfenhongset']!=1}style="display:none"{/if}>
									<div class="layui-form-item">
										<label class="layui-form-label">分红比例：</label>
										{if !$gdlevellist}<div class="layui-form-mid" style="color:red">未设置具有股东分红权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置</div>{/if}
										{foreach $gdlevellist as $level}
										<div class="layui-input-inline layui-module-itemL">
											<div> {$level.name}(%) </div>
											<input type="text" name="fail_gdfenhongdata1[{$level.id}][commission]" class="layui-input" value="{$fail_gdfenhongdata1[$level['id']]['commission']}">
										</div>
										{/foreach}
									</div>
								</div>
								<div id="fail_gdfenhongset2" {if $info['fail_gdfenhongset']!=2}style="display:none"{/if}>
									<div class="layui-form-item">
										<label class="layui-form-label">分红金额：</label>
										{if !$gdlevellist}<div class="layui-form-mid" style="color:red">未设置具有股东分红权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置</div>{/if}
										{foreach $gdlevellist as $level}
										<div class="layui-input-inline layui-module-itemL">
											<div> {$level.name}(元) </div>
											<input type="text" name="fail_gdfenhongdata2[{$level.id}][commission]" class="layui-input" value="{$fail_gdfenhongdata2[$level['id']]['commission']}">
										</div>
										{/foreach}
									</div>
								</div>
								{/if}
								{if $auth_data=='all' || in_array('areafenhong',$auth_data)}
								<div class="layui-form-item">
									<label class="layui-form-label">区域代理分红：</label>
									<div class="layui-input-block" style="width:700px">
										<input type="radio" name="info[fail_areafenhongset]" value="0" {if !$info['id'] || $info['fail_areafenhongset']==0}checked{/if} title="按照会员等级" lay-filter="fail_areafenhongset">
										<input type="radio" name="info[fail_areafenhongset]" value="1" {if $info['fail_areafenhongset']==1}checked{/if} title="单独设置分红比例" lay-filter="fail_areafenhongset">
										<input type="radio" name="info[fail_areafenhongset]" value="2" {if $info['fail_areafenhongset']==2}checked{/if} title="单独设置分红金额" lay-filter="fail_areafenhongset">
										<input type="radio" name="info[fail_areafenhongset]" value="-1" {if $info['fail_areafenhongset']==-1}checked{/if} title="不参与分红" lay-filter="fail_areafenhongset">
									</div>
									<div class="layui-form-mid layui-word-aux">设置分红比例或分红金额后该等级的同一个代理区域的人平均分摊所有商城内该区域的订单的分红提成比例或分红金额</div>
								</div>
								{php}
								$fail_areafenhongdata1 = json_decode($info['fail_areafenhongdata1'],true);
								if(!$fail_areafenhongdata1) $fail_areafenhongdata1 = [];
								$fail_areafenhongdata2 = json_decode($info['fail_areafenhongdata2'],true);
								if(!$fail_areafenhongdata2) $fail_areafenhongdata2  = [];
								{/php}
								<div id="fail_areafenhongset1" {if $info['fail_areafenhongset']!=1}style="display:none"{/if}>
									<div class="layui-form-item">
										<label class="layui-form-label">分红比例：</label>
										{if !$areafhlevellist}<div class="layui-form-mid" style="color:red">未设置具有区域代理分红权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置</div>{/if}
										{foreach $areafhlevellist as $level}
										<div class="layui-input-inline layui-module-itemL">
											<div> {$level.name}(%) </div>
											<input type="text" name="fail_areafenhongdata1[{$level.id}][commission]" class="layui-input" value="{$fail_areafenhongdata1[$level['id']]['commission']}">
										</div>
										{/foreach}
									</div>
								</div>
								<div id="fail_areafenhongset2" {if $info['fail_areafenhongset']!=2}style="display:none"{/if}>
									<div class="layui-form-item">
										<label class="layui-form-label">分红金额：</label>
										{if !$areafhlevellist}<div class="layui-form-mid" style="color:red">未设置具有区域代理分红权限的{:t('会员')}等级，请先在[{:t('会员')}]-[等级及分销]设置</div>{/if}
										{foreach $areafhlevellist as $level}
										<div class="layui-input-inline layui-module-itemL">
											<div> {$level.name}(元) </div>
											<input type="text" name="fail_areafenhongdata2[{$level.id}][commission]" class="layui-input" value="{$fail_areafenhongdata2[$level['id']]['commission']}">
										</div>
										{/foreach}
									</div>
								</div>
								{/if}
								</div>
								{/if}

								{/if}					


								{if getcustom('luckycollage_memberlevel_limit')}
								<div class="layui-form-item">
									<label class="layui-form-label">参团等级条件：</label>
									<div class="layui-input-inline" style="width:800px">
										<input type="checkbox" name="info[gettj][]" value="-1" title="所有人" lay-skin="primary" {if !$info['id'] || in_array('-1',$info['gettj'])}checked{/if} lay-filter="gettjset"/>
										<input type="checkbox" name="info[gettj][]" value="0" title="关注用户" lay-skin="primary" {if in_array('0',$info['gettj'])}checked{/if}/>
										{foreach $levellist as $v}
										<input type="checkbox" name="info[gettj][]" value="{$v.id}" title="{$v.name}" lay-skin="primary" {if in_array($v['id'],$info['gettj'])}checked{/if}/>
										{/foreach}
									</div>
								</div>
								{/if}
									{if getcustom('member_tag')}
										<div class="layui-form-item">
											<label class="layui-form-label">标签设置：</label>
											<div class="layui-input-inline" style="width:420px">
												<input type="radio" name="info[istag]"  lay-filter="memberstag" value="0" title="关闭" {if !$info['id'] || $info['istag']==0}checked{/if}/>
												<input type="radio" name="info[istag]"  lay-filter="memberstag" value="1" title="开启" {if $info['id'] && $info['istag']==1}checked{/if}/>
									
											</div>
										</div>
										<div id="membertag" {if !$info['istag']}style="display:none"{/if}>
											{php} $tagarr = json_decode($info['tags'],true);{/php}
											{if !$tagarr}{php}$tagarr = ['membertags'=>0,'tagzjnum'=>0,'tagbzjnum'=>0];{/php}{/if}
											
											 <div class="layui-form-item">
												<label class="layui-form-label"></label>
												<div class="layui-input-inline" style="width:120px">
													<select name="membertags[]"  >
														<option value="-1" {if $tagarr['membertags']==-1}selected{/if}>全部会员</option>
														{foreach $tags as $t}
														<option value="{$t['id']}" {if $t['id']==$tagarr['membertags']}selected{/if}>{$t['name']}</option>
														{/foreach}
													</select>
												</div>
												<div class="layui-form-mid">中奖1次</div>

												<div class="layui-form-mid">间隔</div>
												<div class="layui-input-inline" style="width:90px">
													<input type="text" name="tagbzjnum[]" class="layui-input" value="{$tagarr['tagbzjnum']}">
												</div>
												<div class="layui-form-mid">次</div>
												<!--{if $k==0}
												<button class="layui-btn layui-btn-primary" onclick="addtag()"><i class="fa fa-plus"></i></button>
												{else}
												<button class="layui-btn layui-btn-primary" onclick="removetag(this)"><i class="fa fa-minus"></i></button>
												{/if}-->
											</div>
										</div>			
									
									<script>
										function addtag(){
											var html = '';
											html+='<div class="layui-form-item">';
											html+='	<label class="layui-form-label"></label>';
											html+='	<div class="layui-input-inline" style="width:120px">';
											html+='		<select name="membertags[]">';
											html+='			<option value="0">全部会员</option>';
											{foreach $tags as $t}
											html+='			<option value="{$t['id']}">{$t['name']}</option>';
											{/foreach}
											html+='		</select>';
											html+='	</div>';
											html+='<div class="layui-form-mid">中奖</div>';
											html+='	<div class="layui-input-inline" style="width:90px">';
											html+='		<input type="text" name="tagzjnum[]" class="layui-input" value="1">';
											html+='	</div>';
											html+='	<div class="layui-form-mid">次</div>';
											html+='	<div class="layui-form-mid">间隔</div>';
											html+='	<div class="layui-input-inline" style="width:90px">';
											html+='		<input type="text" name="tagbzjnum[]" class="layui-input" value="1">';
											html+='	</div>';
											html+='	<div class="layui-form-mid">次</div>';
										
					
											html+='	<button class="layui-btn layui-btn-primary" onclick="removetag(this)"><i class="fa fa-minus"></i></button>';
											html+='</div>';
											$('#membertag').append(html);
											layui.form.render();
										}
										function removetag(obj){
											$(obj).parent().remove();
										}
										</script>
									{/if}
									{if getcustom('plug_tengrui')}
			                        <div class="layui-form-item">
			                            <label class="layui-form-label">认证{:t('会员')}：</label>
			                            <div class="layui-input-inline">
			                                <input type="radio" name="info[is_rzh]" value="0" {if !$info['id'] || $info['is_rzh']==0}checked{/if} title="否"/>
			                                <input type="radio" name="info[is_rzh]" value="1" {if $info['id'] && $info['is_rzh']==1}checked{/if} title="是"/>
			                            </div>
			                        </div>
			                        <div class="layui-form-item">
			                            <label class="layui-form-label">{:t('会员')}关系：</label>
			                            <div class="layui-input-inline" style="width:500px">
			                            <input type="radio" name="info[relation_type]" value="-1" {if !$info['id'] || $info['relation_type']==-1}checked{/if} title="所有"/>
			                                <input type="radio" name="info[relation_type]" value="0" {if $info['id'] && $info['relation_type']==0}checked{/if} title="业主"/>
			                                <input type="radio" name="info[relation_type]" value="1" {if $info['id'] && $info['relation_type']==1}checked{/if} title="家属"/>
			                                <input type="radio" name="info[relation_type]" value="2" {if $info['id'] && $info['relation_type']==2}checked{/if} title="租户"/>
			                                <input type="radio" name="info[relation_type]" value="3" {if $info['id'] && $info['relation_type']==3}checked{/if} title="买断"/>
			                                <input type="radio" name="info[relation_type]" value="4" {if $info['id'] && $info['relation_type']==4}checked{/if} title="租用"/>
			                            </div>
			                        </div>
			                        <div class="layui-form-item">
			                            <label class="layui-form-label">一户仅限一次：</label>
			                            <div class="layui-input-inline">
			                                <input type="radio" name="info[house_status]" value="0" {if $info['id'] && $info['house_status']==0}checked{/if} title="否"/>
			                                <input type="radio" name="info[house_status]" value="1" {if !$info['id'] || $info['house_status']==1}checked{/if} title="是"/>
			                            </div>
			                            <div class="layui-form-mid layui-word-aux" style="margin-left:10px;">需是认证用户，且同一个小区的同一户只限一人购买，即一户仅限一次</div>
			                        </div>
			                        <div class="layui-form-item">
			                            <label class="layui-form-label">授权小区：</label>
			                            <div class="layui-input-inline" style="width:500px">
			                                <input type="radio" name="info[group_status]" value="0" {if $info['group_status']==0}checked{/if} title="关闭" lay-filter="group_status"/>
			                                <input type="radio" name="info[group_status]" value="1" {if $info['group_status']==1}checked{/if} title="开启" lay-filter="group_status"/>
			                            </div>
			                            <div class="group_status1 fwtypeExtend" style="clear:both;{if $info['group_status']!=1}display:none{/if}">
			                                <label class="layui-form-label"></label>
			                                <div class="layui-input-inline" style="width:auto">
			                                    <table id="setgroupdiv"  class="layui-table" style="width:500px">
			                                        <thead>
			                                        <tr>
			                                            <th>小区ID</th>
			                                            <th>小区名称</th>
			                                            <th>操作</th>
			                                        </tr>
			                                        </thead>
			                                        {if $groupdata}
			                                        {foreach $groupdata as $gk=>$gv}
			                                        <tr class="grouplisttr"><td>{$gv.id}</td><td>{$gv.fullName}</td><td><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="delGroup(this,{$gv.id})">删除</button></td></tr>
			                                        {/foreach}
			                                        {/if}
			                                        <tr id="groupaddtr">
			                                            <td colspan="3"><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="showChooseGroup()">添加</button></td>
			                                        </tr>
			                                    </table>
			                                    <input type="hidden" name="info[group_ids]" value="{$info.group_ids}"/>
			                                </div>
			                            </div>
			                            <script>
			                            var chooseGroupLayer;
			                            function showChooseGroup(){
			                                chooseGroupLayer = layer.open({type:2,title:'选择分组',content:"{:url('MemberTrGroup/choosegroup')}",area:['1000px','600px'],shadeClose:true});
			                            }
			                            function chooseGroup(fid,fname){
			                                layer.close(chooseGroupLayer);
			                                var group_ids = [];
			                                var isadd = 0;
			                                $('.grouplisttr').each(function(){
			                                    var thisfid = $(this).find('td:eq(0)').html();
			                                    if(thisfid == fid){
			                                        isadd = 1
			                                        dialog('该分组已添加过了');
			                                    }
			                                    group_ids.push(thisfid)
			                                })
			                                if(isadd == 0){
			                                    group_ids.push(fid)
			                                    $("input[name='info[group_ids]']").val(group_ids.join(','));
			                                    $('#groupaddtr').before('<tr class="grouplisttr"><td>'+fid+'</td><td>'+fname+'</td><td><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="delGroup(this,'+fid+')">删除</button></td></tr>');
			                                }
			                                console.log(group_ids)
			                            }
			                            function delGroup(obj,fid){
			                                $(obj).parent().parent().remove();
			                                var group_ids = [];
			                                $('.grouplisttr').each(function(){
			                                    group_ids.push($(this).find('td:eq(0)').html())
			                                })
			                                $("input[name='info[group_ids]']").val(group_ids.join(','));
			                            }
			                            </script>
			                        </div>
				                    {/if}

									<div class="layui-form-item">
										<label class="layui-form-label">销量：</label>
										<div class="layui-input-inline">
											<input type="text" name="info[sales]" value="{$info['id']?$info['sales']:'0'}" class="layui-input">
											<input type="hidden" name="info[oldsales]" value="{$info['id']?$info['sales']:'0'}" class="layui-input">
										</div>
									</div>
									<div class="layui-form-item">
										<label class="layui-form-label">序号：</label>
										<div class="layui-input-inline">
											<input type="text" name="info[sort]" value="{$info['id']?$info['sort']:'0'}" class="layui-input">
										</div>
										<div class="layui-form-mid layui-word-aux">用于排序,越大越靠前</div>
									</div>
									<div class="layui-form-item">
										<label class="layui-form-label">状态：</label>
										<div class="layui-input-inline">
											<input type="radio" name="info[status]" value="1" title="已上架" {if !$info['id'] || $info['status']==1}checked{/if}/>
											<input type="radio" name="info[status]" value="0" title="未上架" {if $info['id'] && $info['status']==0}checked{/if}/>
										</div>
									</div>
									
									<div class="layui-form-item">
										<label class="layui-form-label"></label>
										<div class="layui-input-block">
											<button class="layui-btn layui-btn-normal" onclick="gonext(2)">下一步:编辑商品详情</button>
											<button class="layui-btn layui-btn-danger" lay-submit lay-filter="formsubmit">提 交</button>
										</div>
									</div>

								</div>
								<div class="layui-tab-item">
									<!-- 详情编辑器 -->
									<?php 
									$pagetitle='商品详情';
									$pagedata= $info['detail'] && json_decode($info['detail']) ? $info['detail'] : '[{"id":"M0000000000000","temp":"richtext","params":{bgcolor:"#FFFFFF",margin_x:"0",margin_y:"0",padding_x:"10",padding_y:"10","quanxian":{"all":true},"platform":{"all":true}},"data":"","other":"","content":""}]';
									?>
									{include file="designer_page/designer_editor" /}
									<div class="layui-form-item">
										<div class="layui-input-block">
											<button class="layui-btn layui-btn-normal" onclick="gonext(1)">上一步:编辑商品信息</button>
											<button class="layui-btn layui-btn-danger" lay-submit lay-filter="formsubmit">提 交</button>
										</div>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
      </div>
    </div>
  </div>
	<script>
		//var ueditor = UE.getEditor('content');
		layui.form.on('radio(group_status)',function(data){
	        if(data.value == 1){
	            $('.group_status1').show();
	        }else{
	            $('.group_status1').hide();
	        }
	    })
		layui.form.on('radio(commissionset)', function(data){
			if(data.value == '1'){
				$('#commissionset1').show();
				$('#commissionset2').hide();
				$('#commissionset3').hide();
			}else if(data.value == '2'){
				$('#commissionset1').hide();
				$('#commissionset2').show();
				$('#commissionset3').hide();
			}else if(data.value == '3'){
				$('#commissionset1').hide();
				$('#commissionset2').hide();
				$('#commissionset3').show();
			}else{
				$('#commissionset1').hide();
				$('#commissionset2').hide();
				$('#commissionset3').hide();
			}
		});
		layui.form.on('radio(fail_commissionset)', function(data){
			if(data.value == '1'){
				$('#fail_commissionset1').show();
				$('#fail_commissionset2').hide();
				$('#fail_commissionset3').hide();
			}else if(data.value == '2'){
				$('#fail_commissionset1').hide();
				$('#fail_commissionset2').show();
				$('#fail_commissionset3').hide();
			}else if(data.value == '3'){
				$('#fail_commissionset1').hide();
				$('#fail_commissionset2').hide();
				$('#fail_commissionset3').show();
			}else{
				$('#fail_commissionset1').hide();
				$('#fail_commissionset2').hide();
				$('#fail_commissionset3').hide();
			}
		});
		layui.form.on('radio(fenhongset)', function(data){
			if(data.value == '1'){
				$('#fenhongset').show();
			}else{
				$('#fenhongset').hide();
			}
		})
		layui.form.on('radio(teamfenhongset)', function(data){
			if(data.value == '1'){
				$('#teamfenhongset1').show();
				$('#teamfenhongset2').hide();
			}else if(data.value == '2'){
				$('#teamfenhongset1').hide();
				$('#teamfenhongset2').show();
			}else{
				$('#teamfenhongset1').hide();
				$('#teamfenhongset2').hide();
			}
		})
		layui.form.on('radio(gdfenhongset)', function(data){
			if(data.value == '1'){
				$('#gdfenhongset1').show();
				$('#gdfenhongset2').hide();
			}else if(data.value == '2'){
				$('#gdfenhongset1').hide();
				$('#gdfenhongset2').show();
			}else{
				$('#gdfenhongset1').hide();
				$('#gdfenhongset2').hide();
			}
		})
		layui.form.on('radio(areafenhongset)', function(data){
			if(data.value == '1'){
				$('#areafenhongset1').show();
				$('#areafenhongset2').hide();
			}else if(data.value == '2'){
				$('#areafenhongset1').hide();
				$('#areafenhongset2').show();
			}else{
				$('#areafenhongset1').hide();
				$('#areafenhongset2').hide();
			}
		})


		layui.form.on('radio(fail_fenhongset)', function(data){
			if(data.value == '1'){
				$('#fail_fenhongset').show();
			}else{
				$('#fail_fenhongset').hide();
			}
		})
		layui.form.on('radio(fail_teamfenhongset)', function(data){
			if(data.value == '1'){
				$('#fail_teamfenhongset1').show();
				$('#fail_teamfenhongset2').hide();
			}else if(data.value == '2'){
				$('#fail_teamfenhongset1').hide();
				$('#fail_teamfenhongset2').show();
			}else{
				$('#fail_teamfenhongset1').hide();
				$('#fail_teamfenhongset2').hide();
			}
		})
		layui.form.on('radio(fail_gdfenhongset)', function(data){
			if(data.value == '1'){
				$('#fail_gdfenhongset1').show();
				$('#fail_gdfenhongset2').hide();
			}else if(data.value == '2'){
				$('#fail_gdfenhongset1').hide();
				$('#fail_gdfenhongset2').show();
			}else{
				$('#fail_gdfenhongset1').hide();
				$('#fail_gdfenhongset2').hide();
			}
		})
		layui.form.on('radio(fail_areafenhongset)', function(data){
			if(data.value == '1'){
				$('#fail_areafenhongset1').show();
				$('#fail_areafenhongset2').hide();
			}else if(data.value == '2'){
				$('#fail_areafenhongset1').hide();
				$('#fail_areafenhongset2').show();
			}else{
				$('#fail_areafenhongset1').hide();
				$('#fail_areafenhongset2').hide();
			}
		})

		layui.form.on('radio(fy_type)', function(data){
			if(data.value == '1'){
				$('#fy_type1').show();
				$('#fy_type2').hide();
			}else if(data.value == '2'){
				$('#fy_type1').hide();
				$('#fy_type2').show();
			}
		});

		
		//标签设置
		layui.form.on('radio(memberstag)', function(data){
			if(data.value == '1'){
				$('#membertag').show();
			}else{
				$('#membertag').hide();
			}
		})
		


		//团长奖励
		layui.form.on('radio(tzjl_type)', function(data){
			$('#member_money').hide();
			$('#leaderscore').hide();
			$('#zstzcommission').hide();
			$('#tzyhq').hide();
			if(data.value == '1'){
				$('#member_money').show();
			}else if(data.value == '2'){
				$('#leaderscore').show();
			}else if(data.value == '3'){
				$('#zstzcommission').show();
			}else if(data.value == '4'){
				$('#tzyhq').show();
			}
		});
		//分享奖励
		layui.form.on('radio(sharejl_type)', function(data){
			$('#sharemoney').hide();
			$('#sharescore').hide();
			$('#sharecommission').hide();
			$('#sharejlyhq').hide();
			if(data.value == '1'){
				$('#sharemoney').show();
			}else if(data.value == '2'){
				$('#sharescore').show();
			}else if(data.value == '3'){
				$('#sharecommission').show();
			}else if(data.value == '4'){
				$('#sharejlyhq').show();
			}
		});

		//中奖奖励
		layui.form.on('radio(zjjl_type)', function(data){
			$('#zj_money').hide();
			$('#zjscore').hide();
			$('#zjcommission').hide();
			$('#zjyhq').hide();
			{if getcustom('luckycollage_zjjl')}
			$('.zj_money_type').hide();
			$('.zjjlscore_type').hide();
			{/if}
			if(data.value == '1'){
				$('#zj_money').show();
				{if getcustom('luckycollage_zjjl')}
				$('#zj_money_type').show();
				var zj_money_type = $("input[name='info[zj_money_type]']:checked").val();
				if(zj_money_type == 1){
					$('#zj_money_type1').show();
					$('#zj_money').hide();
				}else if(zj_money_type == 2){
					$('#zj_money').show();
					$('#zj_money_type1').hide();
				}
				{/if}
			}else if(data.value == '2'){
				$('#zjscore').show();
				{if getcustom('luckycollage_zjjl')}
				$('#zjjlscore_type').show();
				var zjjlscore_type = $("input[name='info[zjjlscore_type]']:checked").val();				
				if(zjjlscore_type == 1){
					$('#zjjlscore_type1').show();
					$('#zjscore').hide();
				}else if(zjjlscore_type == 2){
					$('#zjscore').show();
					$('#zjjlscore_type1').hide();
				}
				{/if}
			}else if(data.value == '3'){
				$('#zjcommission').show();
			}else if(data.value == '4'){
				$('#zjyhq').show();
			}
		});
		layui.form.on('radio(zjjlscore_type)', function(data){
			$('#zjscore').hide();
			$('#zjjlscore_type1').hide();
			if(data.value == '1'){
				$('#zjjlscore_type1').show();
			}else if(data.value == '2'){
				$('#zjscore').show();
			}
		});
		layui.form.on('radio(zj_money_type)', function(data){
			$('#zj_money').hide();
			$('#zj_money_type1').hide();
			if(data.value == '1'){
				$('#zj_money_type1').show();
			}else if(data.value == '2'){
				$('#zj_money').show();
			}
		});
		//不中奖奖励
		layui.form.on('radio(bzjl_type)', function(data){
			$('#bzj_money').hide();
			$('#bzjscore').hide();
			$('#bzjcommission').hide();
			$('#bzjyhq').hide();
			{if getcustom('luckycollage_bzjl')}
			$('#bzjlscore_type').hide();
			$('.bzjlscore_type').hide();
			{/if}
			if(data.value == '1'){
				$('#bzj_money').show();
			}else if(data.value == '2'){
				$('#bzjscore').show();
				{if getcustom('luckycollage_bzjl')}
				$('#bzjlscore_type').show();
				var bzjlscore_type = $("input[name='info[bzjlscore_type]']:checked").val();
				if(bzjlscore_type == 1){
					$('#bzjlscore_type1').show();
					$('#bzjscore').hide();
				}else if(bzjlscore_type == 2){
					$('#bzjscore').show();
					$('#bzjlscore_type1').hide();
				}
				{/if}
			}else if(data.value == '3'){
				$('#bzjcommission').show();
			}else if(data.value == '4'){
				$('#bzjyhq').show();
			}
		});
		layui.form.on('radio(bzjlscore_type)', function(data){
			$('#bzjscore').hide();
			$('#bzjlscore_type1').hide();
			if(data.value == '1'){
				$('#bzjlscore_type1').show();
			}else if(data.value == '2'){
				$('#bzjscore').show();
			}
		});
		//开启时间限制
		layui.form.on('radio(isktdate)', function(data){
			if(data.value == '1'){
				$('#ktdate').show();
			}else{
				$('#ktdate').hide();
			}
		});
		layui.form.on('radio(freighttypeset)', function(data){
			freightset(data.value)
		})

		function freightset(val){
			if(val == '1'){
				$('#setfreight').hide();
				$('#freighttype3').hide();
				$('#freighttype4').hide();
				$('#freighttype3_4').hide();
			}else if(val == '3'){
				$('#setfreight').hide();
				$('#freighttype3').show();
				$('#freighttype4').hide();
				$('#freighttype3_4').show();
			}else if(val == '4'){
				$('#setfreight').hide();
				$('#freighttype3').hide();
				$('#freighttype4').show();
				$('#freighttype3_4').show();
			}else{
				$('#setfreight').show();
				$('#freighttype3').hide();
				$('#freighttype4').hide();
				$('#freighttype3_4').hide();
			}
		}
		//团长奖励模式
		layui.form.on('radio(fy_type)', function(data){
			if(data.value == '1'){
				$('#fy_type1').show();
				$('#fy_type2').hide();
			}else if(data.value == '2'){
				$('#fy_type1').hide();
				$('#fy_type2').show();
			}
		});
        {if getcustom('luckycollage_scoredk')}
        layui.form.on('radio(scoredkmaxset)', function(data){
            if(data.value == '1'){
                $('#scoredkmaxset1').show();
                $('#scoredkmaxunit').html('%');
            }else if(data.value == '2'){
                $('#scoredkmaxset1').show();
                $('#scoredkmaxunit').html('元');
            }else{
                $('#scoredkmaxset1').hide();
            }
        })
        {/if}
		layui.laydate.render({ 
			elem: '#kaituan_date'
			,type: 'date'
			,range: false,
			trigger: 'click'
		});
		function showChooseProduct(){
			layer.open({type:2,title:'选择商品',content:"{:url('ShopProduct/chooseproduct')}/showallbusiness/true",area:['1000px','600px'],shadeClose:true});
		}
		function choosepro(data){
			//showgg(data.guigedata,data.gglist);
			$("input[name='info[name]']").val(data.product.name);
			$("input[name='info[pic]']").val(data.product.pic);
			$('#picPreview img').attr('src',data.product.pic)
			$("input[name='info[pics]']").val(data.product.pics);
			if(data.product.pics!=''){
				var pics = data.product.pics.split(',');
				var picshtml = '';
				for(var i=0;i<pics.length;i++){
					picshtml+='<div class="layui-imgbox">';
					picshtml+='	<a class="layui-imgbox-close" href="javascript:void(0)" onclick="$(this).parent().remove();getpicsval(\'pics\',\'picList\')" title="删除"><i class="layui-icon layui-icon-close-fill-opaque"></i></a>';
					picshtml+='	<span class="layui-imgbox-img"><img src="'+pics[i]+'"></span>';
					picshtml+='</div>';
				}
				$('#picList').html(picshtml);
			}
			//$("input[name='info[fuwupoint]']").val(data.product.fuwupoint);
			//$("input[name='info[sellpoint]']").val(data.product.sellpoint);
			//$("input[name='info[procode]']").val(data.product.procode);
			$("input[name='info[sell_price]']").val(data.product.sell_price);
			$("input[name='info[score_price]']").val(data.product.sell_price*100);
			$("input[name='info[money_price]']").val(0);
			$("input[name='info[weight]']").val(data.product.weight);
			$("input[name='info[stock]']").val(data.product.stock);
			$("input[name='info[sales]']").val(data.product.sales);
			//根据商品返回值，更改配送模板
			//20240326
			freightset(data.product.freighttype);
			$("input[name='info[freighttype]'][value='"+data.product.freighttype+"']").prop('checked', true);
			layui.form.render();
			$("input[name='info[contact_require]']").prop('checked', data.product.contact_require);

			//规格
			var guigedata = data.guigedata;
			if(guigedata){
				var gghtml = '<thead><tr><th>规格分组</th><th>规格名称</th><th>操作</th></tr></thead>';
				for(var i=0;i<guigedata.length;i++){
					var gg = guigedata[i];
					gghtml+='<tr>';
					gghtml+='	<td><input type="text" class="layui-input" name="ggname" value="'+gg.title+'" style="width:120px"/></td>';
					gghtml+='	<td>';
					var ggitems = gg['items']
					for(var j=0;j<ggitems.length;j++){
						gghtml+='		<div><input type="text" class="layui-input"style="width:180px" value="'+ggitems[j]['title']+'" placeholder="请输入规格名称">';
						if(j==0){
							gghtml+='			<button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="addggname(this)" style="margin-top:-3px;"><i class="fa fa-plus" style="font-size:14px!important"></i></button>';
						}else{
							gghtml+='			<button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="$(this).parent().remove()" style="margin-top:-3px;"><i class="fa fa-remove" style="font-size:14px!important"></i></button>';
						}
						gghtml+='		</div>';
					}
					gghtml+='	</td>';
					if(i==0){
						gghtml+='	<td><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="addggtype()">添加</button></td>';
					}else{
						gghtml+='	<td><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="$(this).parent().parent().remove()">删除</button></td>';
					}
					gghtml+='</tr>';
				}
				$('#ggnamediv').html(gghtml);
			}
			oldgglist = data.gglist;
			refreshgg();
			//ueditor.setContent(data.product.detail);
			var $scope = angular.element(document.querySelector('[ng-controller=FoxController]')).scope();
			$scope.Items = JSON.parse(data.product.detail);
			$scope.focus = $scope.Items[0].id;
			$scope.$apply();
		}
		function gonext(layid){
			$(window).scrollTop(0);
			layui.element.tabChange('mytab', layid);
		}
		//var ueditor = UE.getEditor('editor');
		var oldgglist = {:json_encode($newgglist)};
		$(function(){
			refreshgg();
		})
		function addggtype(){
			var gghtml = '<tr>';
			gghtml += '<td><input type="text" name="ggname" class="layui-input" value="" style="width:120px" placeholder="请输入规格分组"/></td>';
			gghtml += '<td><div><input type="text" class="layui-input" style="width:180px" value="" placeholder="请输入规格名称"> <button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="addggname(this)" style="margin-top:-3px;"><i class="fa fa-plus" style="font-size:14px!important"></i></button></div></td>';
			gghtml += '<td><button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="$(this).parent().parent().remove()">删除</button></td>';
			gghtml += '</tr>';
			$('#ggnamediv').append(gghtml);
		}
		function addggname(obj){
			var ggnameobj = $(obj).parent().parent().append('<div><input class="layui-input" type="text" style="width:180px" value="" placeholder="请输入规格名称"> <button type="button" class="layui-btn layui-btn-sm layui-btn-primary" onclick="$(this).parent().remove()" style="margin-top:-3px;"><i class="fa fa-remove" style="font-size:14px!important"></i></button></div>');
		}
		var specs = [];
		function refreshgg(){
			var haskong = 0
			$('#ggnamediv').find("input").each(function(){
				if($(this).val()=='') haskong = 1
			})
			if(haskong){
				layer.msg('请填写完整');return;
			}
			specs = [];
			var i=0;
			$('input[name=ggname]').each(function(){
				var ggval = [];
				var j=0;
				$(this).parent().next().find('input').each(function(){
					ggval.push({ 'k':j,'title':$(this).val()});
					j++
				})
				specs.push({ 'k':i,'title':$(this).val(),'items':ggval});
				i++;
			});
			console.log(specs)
			var len = specs.length;
			var newlen = 1; 
			var h = new Array(len); 
			var rowspans = new Array(len); 
			
			var html = '<thead><tr>';
			for(var i=0;i<len;i++){
				html+="<th>" + specs[i].title + "</th>";
				var itemlen = specs[i].items.length;
				if(itemlen<=0) { itemlen = 1 };
				newlen*=itemlen;
				h[i] = new Array(newlen);
				for(var j=0;j<newlen;j++){
					h[i][j] = new Array();
				}
				var l = specs[i].items.length;
				rowspans[i] = 1;
				for(j=i+1;j<len;j++){
					rowspans[i]*= specs[j].items.length;
				}
			}
			html += '<th>规格编号</th>';
			//html += '<th>成本价（元）</th>';
			html += '<th>单买价（元）</th>';
			html += '<th>拼团价（元）</th>';
			html += '<th>重量（克）</th>';
			html += '<th>库存</th>';
			html += '<th>图片</th>';
			html += '</tr></thead>';
			
			for(var m=0;m<len;m++){
				var k = 0,kid = 0,n=0;
				for(var j=0;j<newlen;j++){
					var rowspan = rowspans[m]; 
					if( j % rowspan==0){
						h[m][j]={ k:specs[m].items[kid].k,title: specs[m].items[kid].title, html: "<td rowspan='" +rowspan + "'>"+ specs[m].items[kid].title+"</td>\r\n",id: specs[m].items[kid].id};
					}else{
						h[m][j]={ k:specs[m].items[kid].k,title:specs[m].items[kid].title, html: "",id: specs[m].items[kid].id};	
					}
					n++;
					if(n==rowspan){
						kid++; if(kid>specs[m].items.length-1) { kid=0; }
						n=0;
					}
				}
			}

			var hh = "";
			for(var i=0;i<newlen;i++){
				hh+="<tr>";
				var ks = [];
				var titles = [];
				for(var j=0;j<len;j++){
					hh+=h[j][i].html; 
					ks.push( h[j][i].k);
					titles.push( h[j][i].title);
				}
				ks2 =ks.join('_');
				ks =ks.join(',');
				titles =titles.join(',');
				if(typeof(oldgglist[ks])!='undefined'){
					var val = oldgglist[ks];
				}else{
					var val = { procode:'',market_price:'',cost_price:'',sell_price:'',weight:'',stock:'1000',pic:''};
				}
			
				hh += '<td>';
				hh += '	<input name="option['+ks+'][procode]" class="layui-input" type="text" style="width:100px" value="'+(val.procode==null?'':val.procode)+'"/>';
				if(i==0){
					hh += ' <i class="fa fa-hand-o-down" style="cursor:pointer" title="批量设置" onclick="plset(\'procode\')"></i>';
				}
				hh += '</td>';
				//hh += '<td>';
				//hh += '	<input name="option['+ks+'][cost_price]" type="text" class="layui-input" style="width:70px" value="'+(val.cost_price==null?'':val.cost_price)+'"/>';
				//if(i==0){
				//	hh += ' <i class="fa fa-hand-o-down" style="cursor:pointer" title="批量设置" onclick="plset(\'cost_price\')"></i>';
				//}
				//hh += '</td>';
				hh += '<td>';
				hh += '	<input name="option['+ks+'][market_price]" type="text" class="layui-input" style="width:70px" value="'+(val.market_price==null?'':val.market_price)+'"/>';
				if(i==0){
					hh += ' <i class="fa fa-hand-o-down" style="cursor:pointer" title="批量设置" onclick="plset(\'market_price\')"></i>';
				}
				hh += '</td>';
				hh += '<td>';
				hh += '	<input name="option['+ks+'][name]" type="hidden" value="'+titles+'" class="layui-input"/><input name="option['+ks+'][sell_price]" type="text" style="width:70px" value="'+(val.sell_price==null?'':val.sell_price)+'" class="layui-input"/>';
				if(i==0){
					hh += ' <i class="fa fa-hand-o-down" style="cursor:pointer" title="批量设置" onclick="plset(\'sell_price\')"></i>';
				}
				hh += '</td>';
				hh += '<td>';
				hh += ' <input name="option['+ks+'][weight]" type="text" style="width:60px" value="'+(val.weight==null?'':val.weight)+'" class="layui-input"/>';
				if(i==0){
					hh += ' <i class="fa fa-hand-o-down" style="cursor:pointer" title="批量设置" onclick="plset(\'weight\')"></i>';
				}
				hh += '</td>';
				hh += '<td>';
				hh += ' <input name="option['+ks+'][stock]" type="text" style="width:60px" value="'+(val.stock==null?'':val.stock)+'" class="layui-input"/>';
				if(i==0){
					hh += ' <i class="fa fa-hand-o-down" style="cursor:pointer" title="批量设置" onclick="plset(\'stock\')"></i>';
				}
				hh += '</td>';
				hh += '<td id="ggpic'+ks2+'"><input type="hidden" name="option['+ks+'][pic]" id="ggpicval'+ks2+'" value="'+(val.pic==null?'':val.pic)+'"/><div class="guigeimg"><img class="thumb_img" src="'+(val.pic==null?'':val.pic)+'" style="max-width:50px;"/><a class="layui-imgbox-close guigeimg_close" style="'+(val.pic=='' ||val.pic==null?'display:none':'display:block')+'"    href="javascript:void(0)" onclick="$(this).prev(\'.thumb_img\').attr(\'src\',\'\');$(this).parent().prev(\'input\').val(\'\');$(this).hide();" title="删除"><i class="layui-icon layui-icon-close-fill-opaque"></i></a></div> <button class="layui-btn layui-btn-sm layui-btn-primary" onclick="uploader(this)" upload-input="ggpicval'+ks2+'" upload-preview="ggpic'+ks2+'" type="button">上传</button></td>';
				hh += "</tr>";
			}
			html+=hh;
			$("#ggvaldiv").html(html);
		}
		function plset(name){
			if(name =='procode'){
				var procode = $("input[name$='["+name+"]']").eq(0).val();
				if(procode == '') procode = randomString(6);
				$("input[name$='["+name+"]']").each(function(i,v){
					if(i>0) $(this).val(procode+ '-'+i);
				})
			}else{
				$("input[name$='["+name+"]']").val($("input[name$='["+name+"]']").eq(0).val());
			}
		}
		function randomString(len) {
	　　len = len || 32;
	　　var $chars = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678';    /****默认去掉了容易混淆的字符oOLl,9gq,Vv,Uu,I1****/
	　　var maxPos = $chars.length;
	　　var pwd = '';
	　　for (i = 0; i < len; i++) {
	　　　　pwd += $chars.charAt(Math.floor(Math.random() * maxPos));
	　　}
	　　return pwd;
		}
		</script>

	<script>
	layui.form.on('submit(formsubmit)', function(obj){
		var field = obj.field
		field.specs = JSON.stringify(specs)
		//field['info[detail]'] = ueditor.getContent();
		field['info[detail]'] = geteditordata();
		//console.log(field);return;
		var index = layer.load();
		$.post("{:url('save')}",field,function(data){
			layer.close(index);
			dialog(data.msg,data.status);
			if(data.status==1){
				setTimeout(function(){
					parent.layer.closeAll();
					parent.tableIns.reload();
				},1000)
			}
		})
	})
	var chooseUrlField = '';
	function chooseUrl2(field){
		chooseUrlField = field;
		layer.open({type:2,shadeClose:true,area:['1200px', '650px'],'title':'选择链接',content:"{:url('DesignerPage/chooseurl')}&callback=chooseLink2"})
	}
	function chooseLink2(urlname,url){
		$("#"+chooseUrlField).val(url);
	}
  </script>
	{include file="public/copyright"/}
</body>
</html>